High-Level: PaymentFlowManager
The recommended approach — handles all UI states automatically.CustomerScreen.tsx
Customer flow states
| State | UI shown |
|---|---|
scanning | ”Hold your phone near the payment terminal” with animated NFC icon |
confirming | Payment details: amount, merchant, currency |
processing | Step-by-step progress indicators |
success | Receipt: amount, transaction ID, timestamp |
error | Contextual message + retry / cancel |
Low-Level: useNFCCustomer
Use the low-level hook when you need full control over the payment UI.Step 1 — Scan the NFC invoice
scanPaymentRequest() internally calls readSignedInvoice() which:
- Enables the NFC reader
- Waits up to 30 seconds for a tag
- Validates the ECDSA signature against the merchant’s registered device keys
- Enforces a 5-minute timestamp window (replay-attack protection)
- Checks the invoice hasn’t expired
- Returns a typed
PaymentRequestobject
Step 2 — Show payment details to user
After successful scan,paymentRequest contains:
Step 3 — Process the payment
Complete Low-Level Example
CustomCustomerFlow.tsx
SESSION_KEY Mode
When usingSESSION_KEY mode, the payment is funded from the user’s own wallet. You don’t need to pass anything extra to processPaymentRequest — the SDK automatically signs the payment with the stored session key.
If no session key exists, TapRailsThemeProvider will show the setup UI before the payment proceeds. See Session Key Setup.
