Payment through company website
The customer scans a QR code and is directed to the taxi company's landing page. The company sends a payment request to them through the Vipps MobilePay app.
Prerequisites
QR code in the taxi
Generate a merchant redirect QR linking to your website or app. Print and place the QR code in your taxi.
How to create a QR code
The QR code contains a Id
that connects it to the taxi where it is located.
Here is an example HTTP POST:
{
"id": "taxi_122_qr",
"redirectUrl": "https://example.com/myTaxiCompany"
}
Webhooks for ePayment events
Register a webhook to alert you when your payment requests are approved.
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.
Here is an example HTTP POST:
{
"url": "https://example.com/mystore_website_backend",
"events": ["epayments.payment.authorized.v1"]
}
Use the secret
to authenticate the message with HMAC. For examples, see
Webhooks API: Request authentication.
The payload from the ePayment webhooks will be in this form:
{
"msn": "123456",
"reference": "24ab7cd6ef658155992",
"pspReference": "1234567891",
"name": "AUTHORIZED",
"amount":
{
"currency": "NOK",
"value": 35000
},
"timestamp": "2023-08-14T12:48:46.260Z",
"idempotencyKey": "49ca711a9487112e1def",
"success": true
}
Note that the payload of the webhook depends on the originating service, in this case the ePayment API.
Details
Step 1: The customer scans the QR
When the customer scans the QR with their phone, they will be redirected to the redirectUrl
.
Step 2: Send the payment request
Send a payment request to the customer
Detailed example
Since the customer has scanned from their phone, you don't need their phone number.
This payment command can do an app-switch and open their Vipps MobilePay app with the payment request.
Specify "userFlow": "WEB_REDIRECT"
to redirect user to the app.
Specify "customerInteraction": "CUSTOMER_PRESENT"
.
Here is an example HTTP POST:
{
"amount": {
"value": 10000,
"currency": "NOK"
},
"paymentMethod": {
"type": "WALLET"
},
"customerInteraction": "CUSTOMER_PRESENT",
"receipt":{
"orderLines": [
{
"name": "trip",
"id": "line_item_1",
"totalAmount": 100000,
"totalAmountExcludingTax": 80000,
"totalTaxAmount": 20000,
"taxPercentage": 25,
},
],
"bottomLine": {
"currency": "NOK",
"posId": "taxi_122",
"tipAmount": 10000
},
"receiptNumber": "0527013501"
},
"reference": 2486791679658155992,
"userFlow": "WEB_REDIRECT",
"returnUrl": "http://example.com/redirect?reference=2486791679658155992",
"paymentDescription": "Travel from Oslo central station to Oslo airport"
}
Step 3: The customer authorizes the payment
The payment request will appear in the customer's Vipps MobilePay app, where they can select to pay or cancel.
To get confirmation that payment was approved, monitor your webhooks.
Once the payment is approved, update the status in your system.
Step 4: Capture the payment
Capture the payment and confirm that it was successful.
Detailed example
POST:/epayment/v1/payments/{reference}/capture
With body:
{
"modificationAmount": {
"value": 10000,
"currency": "NOK"
}
}