Skip to main content

Payment through taximeter

The customer orders a taxi in the taxi company's app. After the journey, the taximeter automatically initiates a payment request to Vipps with the customer's phone number, which is already known. The customer's Vipps MobilePay app opens, and the customer pays the amount due.

Prerequisites

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:

POST:/webhooks/v1/webhooks

{  
"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. Get the customer's phone number

Get the customer's phone number through the taxi app or ask them for it and enter it manually.

Step 2. Initiate a payment request

Use the customer's phone number to send them a request for the taxi fare.

Detailed example

To create this payment, you first send a create payment request, where customer.phoneNumber is set.

Use userFlow:PUSH_MESSAGE and "customerInteraction": "CUSTOMER_PRESENT" while initiating the payment. You need the customer's phone number to send them a request from the taximeter.

You may also attach the receipt at this time.

Here is an example HTTP POST:

POST:/epayment/v1/payments

{
"amount": {
"value": 100000,
"currency": "NOK"
},
"paymentMethod": {
"type": "WALLET"
},
"customer": {
"phoneNumber": 4791234567
},
"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": "PUSH_MESSAGE",
"returnUrl": "http://example.com/redirect?reference=2486791679658155992",
"paymentDescription": "Travel from Oslo central station to Oslo airport"
}

Step 3. The customer approves 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 amount due

Capture the payment and confirm that it was successful.

Detailed example

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

With body:

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

Sequence diagram