Pre-built Order Management API integration
The ePayment API comes with pre-built order management API integration, making it easy to supply order information at payment creation. Read more about the Order Management API in Order Management API. Instead of adding receipt with a different API call, merchant can send the information as part of Create Payment
Create a payment with order lines
Remember to have a fresh access token, see
Set up and Authorize.
Then, call the POST:/epayment/v1/payments
with paymentMethod
type = "WALLET"
.
Please note that it is a requirement to specify the expiresAt
property in the payment initiation request on order to use this feature.
The expiresAt
must be between 10 minutes and 60 days in the future.
curl -X POST https://apitest.vipps.no/epayment/v1/payments \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR-ACCESS-TOKEN" \
-H "Ocp-Apim-Subscription-Key: YOUR-SUBSCRIPTION-KEY" \
-H "Merchant-Serial-Number: YOUR-MSN" \
-H 'Idempotency-Key: YOUR-IDEMPOTENCY-KEY' \
-H "Vipps-System-Name: acme" \
-H "Vipps-System-Version: 3.1.2" \
-H "Vipps-System-Plugin-Name: acme-webshop" \
-H "Vipps-System-Plugin-Version: 4.5.6" \
-d '{
"amount":{
"currency":"NOK",
"value":1000
},
"paymentMethod":{
"type":"WALLET"
},
"reference":"acme-shop-123-order123abc",
"returnUrl":"https://example.com/redirect?reference=acme-shop-123-order123abc",
"userFlow":"PUSH_MESSAGE",
"paymentDescription":"Two pairs of socks",
"expiresAt":"2023-02-15T00:00:00Z",
"receipt":{
"orderLines":[
{
"name":"Vipps socks",
"id":"line_item_1",
"totalAmount":1000,
"totalAmountExcludingTax":800,
"totalTaxAmount":200,
"taxRate": 2550,
"unitInfo":{
"unitPrice":400,
"quantity":"2",
"quantityUnit":"PCS"
},
"discount":0,
"productUrl":"https://example.com/store/socks",
"isReturn":false,
"isShipping":false
},
{
"name":"Home Delivery",
"id":"delivery",
"totalAmount":200,
"totalAmountExcludingTax":100,
"totalTaxAmount":100,
"taxRate": 5000,
"discount":0,
"isReturn":false,
"isShipping":true
}
],
"bottomLine":{
"currency":"NOK",
"tipAmount":0,
"barcode":{
"format":"EAN13",
"data":"696969"
},
"posId":"vipps_pos_122",
"paymentSources":{
"giftCard":2,
"voucher":0,
"cash":0
},
"receiptNumber":"0527013501"
}
}
}'
Create a payment with a URL
curl -X POST https://apitest.vipps.no/epayment/v1/payments \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR-ACCESS-TOKEN" \
-H "Ocp-Apim-Subscription-Key: YOUR-SUBSCRIPTION-KEY" \
-H "Merchant-Serial-Number: YOUR-MSN" \
-H 'Idempotency-Key: YOUR-IDEMPOTENCY-KEY' \
-H "Vipps-System-Name: acme" \
-H "Vipps-System-Version: 3.1.2" \
-H "Vipps-System-Plugin-Name: acme-webshop" \
-H "Vipps-System-Plugin-Version: 4.5.6" \
-d '{
"amount":{
"currency":"NOK",
"value":1000
},
"paymentMethod":{
"type":"WALLET"
},
"reference":"acme-shop-123-order123abc",
"returnUrl":"https://example.com/redirect?reference=acme-shop-123-order123abc",
"userFlow":"PUSH_MESSAGE",
"paymentDescription":"Two pairs of socks",
"expiresAt":"2023-02-15T00:00:00Z",
"receiptUrl":"https://example.com/link/to/my.pdf"
}'
The flow for the customer will look like this when setting order lines:
Example 1 - when setting Order Lines
- Vipps
- MobilePay
The flow for the customer will look like this when setting a URL:
Example 2 - when setting a URL
- Vipps
- MobilePay
Note that the receiptUrl
is displayed in a web view inside the app. It doesn't open the user's browser (e.g., Chrome, Safari).
On iPhone, setting the receiptUrl
will open a webpage or a multipage PDF.
On Android, setting the receiptUrl
behaves differently depending on the phone. Some devices behave the same as the iPhone, but others will open your phone's preferred action of viewing PDF's. The list of behavioral scenarios on Android is endless due to the range of possibilities on that platform.