/dev/v1/*. Payment finalization happens in the system browser and returns via deep link.
Why this works well
No API key on device
The
shx_* key stays on your BFF. The app only ever sees short-lived payment-session URLs.Familiar auth shape
Your app keeps its own login (OAuth, magic-link, social). Shoppex is only commerce.
Flow
- The app asks your BFF to buy a product.
- Your BFF creates the payment in Shoppex.
- The app opens the hosted checkout URL in the system browser.
- Shoppex redirects back to your universal link or return page.
- Your BFF receives the signed webhook and updates the buyer state.
- The app shows the final state after polling or receiving a push notification.
Shape
| Piece | Responsibility |
|---|---|
| Native app | UI, auth, deep-link handler, optimistic “Processing…” state |
| Your BFF | Exchange user session for Dev API calls, receive webhooks, push to device |
| Shoppex | Catalog, payment session, PSP orchestration, webhook emission |
| System browser / ASWebAuthenticationSession | The payment UI itself (required by PSP compliance) |
Key choices
Return URL should be a universal link, not a custom scheme
Universal links (iOS) / app links (Android) hand control back to your app without the “Open in app?” prompt and survive cold starts better thanmyapp://:
Use ASWebAuthenticationSession / Chrome Custom Tabs
Do not embed checkout in aWKWebView — PSPs may block it, 3DS flows may break, and Apple rejects apps that proxy payment forms. Use the system-provided authenticated browser surface.
Optimistic UI
After the deep-link comes back, the app should show “Finalizing…” and pollGET /dev/v1/payments/{uniqid} until status === 'COMPLETED'. The webhook then triggers a push notification for confirmation. Both paths converge on the same order state.
Pitfalls
- Deep-link replay attacks — treat the deep-link return as a hint, not proof of payment. Always confirm state via Dev API call or webhook before granting access.
- App Store review — Apple may reject apps that sell digital goods consumed in-app without IAP. External services, off-device benefits, or fulfillment outside the app are typically the safer fit, but you should still validate the exact flow before launch.
- Push notifications lag — webhooks arrive at your BFF in milliseconds, but APNs / FCM delivery can lag. The app’s polling covers the gap.
Related
Architecture Reference
Setup C (Mobile + BFF) — full diagram and responsibility split.
Webhook Security
HMAC-SHA512, retries, constant-time verification.