Skip to main content

Static QR directing to the app for payment

This flow uses a QR code that is posted on the vending machine. The QR directs the user to the payment screen in their Vipps or MobilePay app.

QR direct to payment

When to use

This QR code can be used when you don't have a screen, and it's not possible to present the dynamic one-time payment QR.

Prerequisites

Merchant Callback QR

Generate a merchant callback QR code.

How to create a merchant callback QR code

The QR code contains a Id that connects it to a specific POS or cash register in your store.

Here is an example HTTP PUT:

PUT:/qr/v1/merchant-callback/{merchantQrId}

{
"locationDescription": "vendingmachine1234",
"category": "VENDING"
}

Details

A Vipps MobilePay QR code is posted on the vending machine.

When the customer scans the QR code, they go directly to the payment screen on their phone, where they can approve the payment.

The payment amount should be the max amount of the vending machine products. After reservation, the amount of the selected product must be captured, and the remaining amount must be released.

Step 1: User scans the QR

When the user scans the QR code, a user.checked-in.v1 webhook event is sent to your backend, containing the customerToken for the user. The user will see a message telling them to choose the product on the vending machine. Webhook for QR code.

Step 2: Initiate a payment request

Create a Payment request to the customerToken from the webhook, with the receipt attached.

Detailed example

Specify the amount of the most expensive item in your vending machine so that any selection they make can be successful.

Specify "customerInteraction": "CUSTOMER_PRESENT". Specify "userFlow": "WEB_REDIRECT" to redirect user to the app.

Here is an example HTTP POST:

POST:/epayment/v1/payments

With body:

{
"amount": {
"value": 5000,
"currency": "NOK"
},
"paymentMethod": {
"type": "WALLET"
},
"customer": {
"customerToken": "wbA8ceVRKkoYiQAVELHeFCC3Sn5dtNCvvEtVPiOT77j6wx7uR965AG6Q+q0ATP4="
},
"customerInteraction": "CUSTOMER_PRESENT",
"reference": 2486791679658155992,
"userFlow": "PUSH_MESSAGE",
"paymentDescription": "Vending machine purchase"
}

Step 3: Customer authorizes the payment

The payment request will appear in the customer's Vipps or MobilePay app, where they can select to pay or cancel.

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 4. Capture the amount due

After the selection is made, determine how much the customer owes and provide a receipt. After final amount is confirmed, do a partial capture.

Check the status of the captured payment.

Detailed example

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

With body:

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

Step 5 Cancel remaining amount

Release the remaining amount from the reservation with a cancel.

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

Detailed example

Here is an example HTTP POST:

POST:/order-management/v2/{paymentType}/receipts/{orderId}

For paymentType, use eCom for eCom or ePayment payments. For orderId, use the chargeId of the charge.

Body:

{
"orderLines": [
{
"name": "Fanta",
"id": "21231211",
"totalAmount": 3000,
"totalAmountExcludingTax": 2250,
"totalTaxAmount": 750,
"taxRate": 2550,
},
],
"bottomLine": {
"currency": "NOK",
"posId": "vending_machine_12345"
}
}

Sequence diagram

Sequence diagram for the vending machine flow with static QR directing to the app for payment.

Next steps

Review some related pages:

Help us improve our documentation

Did you find what you were looking for?