Prerequisites
- An active Payrails session (see Quick Start)
- A session init payload with redirect-capable payment methods configured in the Payrails backend
- Kotlin + Jetpack Compose for rendering the redirect buttons
Steps
1. Initialize a session
2. Discover available redirect methods
Ask the session for redirect payment methods configured by the backend:PayrailsPaymentOption contains:
paymentMethodCode— the identifier used to create the button (e.g.,"ideal","bancontact")displayName— a human-readable label from the backend (nullable)
3. Create a redirect button for each method
4. Handle the redirect flow
When the user taps the button, the SDK:- Opens the payment provider’s page in a Custom Tab (or system browser as fallback)
- Polls the execution status in the background
- Returns the result through the delegate callbacks
Session recovery
If the redirect flow is abandoned or remains non-terminal, the SDK follows the same session recovery path as card 3DS redirects. ConfigureonSessionExpired in Options.redirectSessionLifecycle to enable automatic recovery:
Related
- How to Accept PayPal Payments — PayPal uses the same redirect infrastructure
- SDK API Reference — Full API details for redirect payments
- Quick Start — Get started with the SDK
- SDK Concepts — Payment flow architecture