Payment Flows
The Bahn SDK confirms payments in one of two ways: direct confirmation, where the browser confirms an intent your backend already created, and token-based, where the browser tokenizes the card and your backend confirms. Saving a card uses a third, setup-intent flow.
| You want to… | Flow | Browser calls | Example |
|---|---|---|---|
| Charge an amount you know up front | Confirm Payment | confirmPayment() | HTML · React |
| Decide the amount on your server after seeing the card | Token-Based Flow | createConfirmationToken(), then handleNextAction() | Browser + server |
| Save a card without charging it | Save a Card | confirmCardSetup() | Browser + server |
Each flow can trigger a 3D Secure challenge — see 3DS Authentication.
Apple Pay and Google Pay support both payment flows: pass a clientSecret to bahn.mountApplePay()/bahn.mountGooglePay() for direct confirmation, or omit it for the token-based flow.
Comparison
| Confirm Payment | Token-Based Flow | |
|---|---|---|
| Who creates the payment intent | Your backend, before checkout | Your backend, after receiving the token |
| Who confirms it | The browser (confirmPayment()) | Your backend |
| Amount can change after the card is entered | No | Yes |
| 3DS handling | mount3DS() + pollPaymentIntentStatus() | handleNextAction() does both |
Full parameter and result types for every flow are on Type Definitions.