Skip to main content

Online payments

This illustrates the recommended online payment flow.

ePayment online process

Details

Step 1. Send the payment request

Add the products to the order and send the payment request by using the createPayment endpoint.

Detailed example for payment request

After getting your access token, send the API request for create payment.

Set userFlow to WEB_REDIRECT, so the customer's browser will either do an automatic app-switch or open the landing page to confirm the mobile number. Attach the receipt simultaneously.

For example:

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": {
"value": 49900,
"currency": "NOK"
},
"paymentMethod": {
"type": "WALLET"
},
"customer": {
"phoneNumber": 4712345678
},
"customerInteraction": "CUSTOMER_NOT_PRESENT",
"receipt":{
"orderLines": [
{
"name": "Hoodie",
"id": "hoodie1234",
"totalAmount": 49900,
"totalAmountExcludingTax": 37425,
"totalTaxAmount": 12475,
"taxRate": 2550,
},
],
"bottomLine": {
"currency": "NOK",
"posId": "pos_122",
"receiptNumber": "789267"
},
},
"reference": 58712432,
"userFlow": "WEB_REDIRECT",
"returnUrl": "http://example.com/redirect?reference=58712432",
"paymentDescription": "Hoodie"
}'

Step 2. The customer authorizes the payment

If the payment was started on a desktop device, the customer will be sent to the landing page. There, they confirm their number and are prompted to log in through the Vipps or MobilePay app.

Vipps landing page

If the payment was started from a mobile device, the app will automatically open.

Vipps cart Confirm payment Vipps

To determine that the user has authorized the payment, you can get notifications via the Webhooks API and/or poll for the status.

Once the payment is approved, update the status in your system.

Step 3. Provide confirmation

When the user confirms the payment, they will get a confirmation in the app and then be redirected back to your store.

Confirm to them that the order was successful.

Order confirmation

Step 4. Ship the order (if applicable)

Complete and ship the order to the customer.

Step 5. Capture the payment

Capture the payment with the POST:/epayment/v1/payments/{reference}/capture API request. Confirm that the request was successful.

Detailed example for payment capture

To capture the payment, send the POST:/epayment/v1/payments/{reference}/capture request with the value set to the amount of the purchase.

For example:

curl -X POST https://apitest.vipps.no/epayment/v1/payments/UNIQUE-PAYMENT-REFERENCE/capture \
-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 '{
"modificationAmount": {
"currency": "NOK",
"value": 49900
}
}'

Sequence diagram

Sequence diagram for the standard online payment flow.

Next steps

Now, you can go to the API guide and start experimenting.

👉 Go to the ePayment API guide

Help us improve our documentation

Did you find what you were looking for?