PaymentFlowManager is the top-level component that renders the complete TapRails payment experience. It handles all UI states, NFC operations, and API calls internally.
Import
Usage
Props
PaymentFlowConfig
required
Configuration object that controls which flow to render and how to handle events.
() => void
Called when the merchant cancels the flow. Used to unmount the component. Required when
config.type === 'merchant'.() => void
Called when the customer cancels the flow. Required when
config.type === 'customer'.PaymentFlowConfig
'merchant' | 'customer'
required
Determines which payment flow to render.
'merchant' shows the amount input + HCE waiting screen. 'customer' shows the tap instruction + processing screens.(data) => void
Called when the payment flow completes successfully. Receives
MerchantFlowData or CustomerFlowData depending on the flow type.() => void
Called when the user explicitly cancels the flow.
(error: Error) => void
Called when an unrecoverable error occurs. The component remains mounted with an error screen — call your cancel handler from here to unmount if needed.
Callback Data Types
MerchantFlowData (onComplete for merchant)
CustomerFlowData (onComplete for customer)
Flow State Machines
Merchant
Customer
Examples
PaymentFlowManager renders as a full-screen overlay. Wrap it in a conditional render and toggle visibility via state, rather than using the visible prop pattern.
