How It Works
This page details how app payments flow works. It allows you to accept MobilePay payments within your application while re-directing to the MobilePay app for user approval. It assumes that you already have credentials to successfully call MobilePay APIs and have subscribed to notifications using Webhooks API.
Process Flow
- Sunshine Scenario
- No Webhook Received Scenario
Sunshine scenario is expected for the majority of the time.
- When a user wants to pay with MobilePay in your application, request your backend services to create payment using Payments API.
- Re-direct user to MobilePay app using deep link.
- User confirms payment in the MobilePay app.
- Your backend services receives notification
payment.reserved
and proceeds with capturing payment. - Meanwhile user returns to your application (using re-direct or switching apps) and sees the success screen.
This scenario details what should happen if a user returned to your application and during that period backend services haven't got any updates on the payment state.
- When a user wants to pay with MobilePay in your application, request your backend services to create payment using Payments API.
- Re-direct user to MobilePay app using deep link.
- User confirms/cancel payment or leaves MobilePay app
- User returns to your application (using re-direct or switching apps).
- Invoke backend services to check payment status.
- Backend services haven't received a notification and should invoke Get Single Payments Details to retrieve the latest payment state and decide what to do next.
It is technically possible to use polling instead of webhooks to monitor for payment state—but this is markedly less reliable and may pose challenges if used at scale. MobilePay may enforce rate limiting on API requests, so exercise caution if you decide to use polling. If you decide to go that route, then you should start no sooner than 5 seconds after payment creation and poll every 2 seconds.