Payment through company app
The customer pays the taxi company from their app when ordering the taxi and selects to pay with Vipps MobilePay. The amount is reserved until the final amount is known, at which time the payment is captured.
This flow combines multiple products to illustrate the recommended online payment flow.
Details
Step 1. Initiate a payment request
When the customer is ready to pay, initiate a payment request.
The payment request amount should be large enough to cover the cost of the journey. Do not include the receipt yet, since a receipt is immutable and the true amount is not known yet.
This amount will be reserved on the customer's account, and the unused amount will be released when the journey is finished.
Detailed example
To create this payment, you first send a create payment request.
Since the customer is selecting this from an app on their phone, you don't need their phone number.
This payment command can do an app-switch and open their 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": 31400,
"currency": "NOK"
},
"paymentMethod": {
"type": "WALLET"
},
"customerInteraction": "CUSTOMER_PRESENT",
"reference": 2486791679658155992,
"userFlow": "WEB_REDIRECT",
"returnUrl": "http://example.com/redirect?reference=2486791679658155992",
"paymentDescription": "Travel from Oslo central station to Storo"
}
Step 2. The 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 3. Confirm the order
Upon authorization, the Vipps or MobilePay app should automatically redirect the customer to your app. Confirm that the order has been successful in your app.
Step 4. Capture the amount due
After the drive is complete, calculate how much the customer owes and do a partial capture.
Check the status of the captured payment.
Detailed example
POST:/epayment/v1/payments/{reference}/capture
With body:
{
"modificationAmount": {
"value": 29900,
"currency": "NOK"
}
}
Step 5. Cancel remaining amount
Release the remaining amount from the reservation with a cancel.
POST:/epayment/v1/payments/{reference}/cancel
Step 6. Attach a receipt
Attach a receipt with the amount paid.
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": "trip",
"id": "line_item_1",
"totalAmount": 29900,
"totalAmountExcludingTax": 22425,
"totalTaxAmount": 7475,
"taxRate": 2550,
"productUrl": "https://www.example.com/taxiride",
},
},
],
"bottomLine": {
"currency": "NOK",
"posId": "taxi_122",
}
}
Sequence diagram
Related information
Next steps
Now, you can go to the API guide and start experimenting.
👉 Go to the ePayment API guide