Skip to content

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…FlowBrowser callsExample
Charge an amount you know up frontConfirm PaymentconfirmPayment()HTML · React
Decide the amount on your server after seeing the cardToken-Based FlowcreateConfirmationToken(), then handleNextAction()Browser + server
Save a card without charging itSave a CardconfirmCardSetup()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 PaymentToken-Based Flow
Who creates the payment intentYour backend, before checkoutYour backend, after receiving the token
Who confirms itThe browser (confirmPayment())Your backend
Amount can change after the card is enteredNoYes
3DS handlingmount3DS() + pollPaymentIntentStatus()handleNextAction() does both

Full parameter and result types for every flow are on Type Definitions.

Developers