Skip to main content
The customer flow scans an NFC invoice from the merchant device and processes the payment via the TapRails backend.

High-Level: PaymentFlowManager

The recommended approach — handles all UI states automatically.
CustomerScreen.tsx

Customer flow states


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:
  1. Enables the NFC reader
  2. Waits up to 30 seconds for a tag
  3. Validates the ECDSA signature against the merchant’s registered device keys
  4. Enforces a 5-minute timestamp window (replay-attack protection)
  5. Checks the invoice hasn’t expired
  6. Returns a typed PaymentRequest object

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 using SESSION_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.