usePayment provides direct access to payment creation and processing API calls. Use this when you need to manage the payment lifecycle outside of an NFC flow — for example, processing a payment from a QR code or deep link.
Import
Usage
Return Value
(request: CreatePaymentRequest) => Promise<CreatePaymentResponse | null>
Calls
POST /api/v1/sdk/payments/create. Returns the backend’s payment response including paymentId, merchantWallet, and expiresAt.(request: ProcessPaymentRequest) => Promise<ProcessPaymentResponse | null>
Calls
POST /api/v1/sdk/payments/process. Signals to the backend that a payment should be executed.boolean
true while createPaymentRequest is in-flight.boolean
true while processPaymentRequest is in-flight.CreatePaymentResponse | null
Response from the most recent
createPaymentRequest call.ProcessPaymentResponse | null
Response from the most recent
processPaymentRequest call.APIError | null
Error from the most recent API call.
() => void
Clears the
error state.() => void
Clears all state — useful when starting a new payment cycle.

