useNFCMerchant manages the merchant side of the payment flow: calling the backend to create a payment request and providing state for the result.
Import
Usage
Return Value
Creates a payment request on the TapRails backend. Returns a
PaymentRequest on success, or null if an error occurs (check the error state).true while the backend request is in-flight.true after a payment request has been successfully created.The most recently created payment request, or
null before any request is made.Error from the most recent
createPaymentRequest call, or null on success.Clears all state — useful when starting a new payment flow.
createPaymentRequest params
Payment amount in USDC as a decimal string — e.g.,
"25.00". Do not pass a number.Merchant identifier. Falls back to
merchantId from ContactlessCryptoSDK.initialize() if omitted.Example
After
createPaymentRequest succeeds, call writeSignedInvoice to start NFC emulation (HCE). The hook itself does not initiate NFC — it only handles backend communication.
