useNFCCustomer manages the customer side of the payment flow: scanning an NFC tag from a merchant device and processing the payment via the TapRails backend.
Import
Usage
Return Value
Activates the NFC reader and waits for a merchant’s tag. Validates the ECDSA signature, expiry, and timestamp window before returning. Returns
null on failure (check error).processPaymentRequest
(paymentId, txHash, customerWallet?) => Promise<ProcessPaymentResponse | null>
Submits the scanned payment to the TapRails backend for execution. Returns
null on failure.true while the NFC reader is open and waiting for a tag.Alias for
isReading.true while the backend payment request is in-flight.The payment request read from the NFC tag, or
null before a scan.The result of processing the payment, or
null before processing.Error from the most recent scan or process call.
Clears
paymentRequest, processedPayment, and error — resets the hook to idle.Clears only the
error state.processPaymentRequest params
The
paymentId from the scanned PaymentRequest.Transaction hash. Pass an empty string
"" for POOL mode (the backend provides the hash). Required for SESSION_KEY mode.The customer’s wallet address. Required only in SESSION_KEY mode.

