Skip to main content

Online payments

This flow combines multiple products to illustrate the recommended online payment flow and base on features from the ePayment API and Webhooks API.

ePayment online process

Prerequisites

Webhooks for ePayment events

Register a webhook to alert you when your payment requests are approved. See the Webhooks API guide for more details.

What are webhooks?

When changes happen to your payment request, events are triggered (for example: Authorized, Terminated, Aborted, Cancelled, Expired, and many more).

You can register to receive these events, which is useful for programming an appropriate and quick response.

The webhook will send a message to your web server at the URL you specify.

See the Webhooks API guide for more details.

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

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.

Here is an example HTTP POST:

POST:/epayment/v1/payments

{
"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,
"taxPercentage": 25,
},
],
"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 get confirmation that payment was approved, monitor webhooks and query the payment.

What are webhooks?

When changes happen to your payment request, events are triggered (for example: Authorized, Terminated, Aborted, Cancelled, Expired, and many more).

You can register to receive these events, which is useful for programming an appropriate and quick response.

The webhook will send a message to your web server at the URL you specify.

See the Webhooks API guide for more details.

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 and confirm that it was successful.

Detailed example

POST:/epayment/v1/payments/{reference}/capture

With body:

{
"modificationAmount": {
"value": 49900,
"currency": "NOK"
}
}

Sequence diagram

Sequence diagram for the standard online payment flow.

Help us improve our documentation

Did you find what you were looking for?