Testing hosted payments in the sandbox environment is only possible with the direct
vipps integration or dintero_psp.vipps, so some testing will have to be done with real payments.Creating a hosted payment session
Setconfiguration.channel=hosted for payment sessions that contain a single payment method.
Request
url in the end users devices to complete the payment.
Payment finished or cancelled
After the user finishes or cancels the payment, they are returned to thereturn_url. Dintero appends the following query parameters:
| Name | Description | Always present |
|---|---|---|
| transaction_id | The transaction ID for the payment | No |
| session_id | The payment session ID | No |
| error | Error code identifying the cause | No |
| merchant_reference | The merchant reference | Yes |
Fallback to the Dintero Checkout
If a session specifiesconfiguration.channel=hosted but its payment method does not support hosted payments, or the session contains more than one payment method, the url returned on session creation opens the Dintero Checkout instead, where the user can complete their payment.
The url will also fall back to Dintero Checkout for Checkout Express sessions, so the end user can submit their shipping and billing information and select a shipping option before payment.
Handling dangling browser tabs on mobile
On mobile devices, the hosted payment acts as a universal link and tries to open the payment directly in the payment method’s native app (e.g. Vipps or MobilePay). If the app is not installed, the browser navigates to the hosted payment page instead. When a payment app is opened via a universal link, the page the user was visiting remains open in the browser. After the payment completes, thereturn_url opens in a new browser tab, leaving the original page open as a dangling pending-payment page.
To handle this, we recommend one or both of the following:
- Update the UI before redirecting. Before opening the hosted payment link, change the payment page to show messaging that the user is being redirected to complete payment.
- Re-check status on focus. Add code that runs when the tab regains focus to check the payment session status. If the user returns to the dangling page, you can then update it to show that the payment completed, or prompt them to try again.