Browse guides
DocsReference
API reference
SDK methods, configuration, payment results and transaction references.
Methods
| Method | Use |
|---|---|
createPayment(input) | Start a direct, hosted, or public inline payment. |
authorizePayment(challengeWithOtp) | Submit an OTP on the backend. |
verifyTransaction(txRef, expected) | Compare the provider transaction with a stored order. |
verifyPayment(providerRef, method, txRef?) | Resume public inline polling. |
Result statuses
result.status | Meaning |
|---|---|
checkout_created | Open data.checkoutUrl for hosted checkout. |
otp_required | Save the challenge server-side and prompt for an OTP. |
pending | The payment is still waiting for confirmation. |
awaiting_verification | Authorization or inline polling completed. Verify on the backend. |
verified | Server verification matched the stored order. This is the only result with success: true. |
failed | The provider reported a failed or cancelled payment. |
unknown | A transport or transient provider error left the outcome uncertain. Reconcile the existing reference. |
error | The operation failed validation, configuration, lookup, or verification checks. Inspect message. |
Configuration and callbacks
- Switch on
result.statusin existingcreatePaymentcallers. Hosted initialization and public-key callbacks no longer signal settlement. - Pass stored expectations as the second argument to
verifyTransaction(txRef, expected). Verified data includesamount,currency,mode,createdAt, the merchanttxRefand the separate ChapaproviderRef. - The root Node import remains available. A Node client with a secret key uses the Direct Charge API for mobile payments. A public-key-only client retains the original four inline methods. Deploy browser and native clients with the public key only.
paymentOptionsrestricts initiation and inline or OTP authorization. An explicittxReftakes precedence overgenerateRefId(). The default generates a Nano ID.maxRetrycounts inline polling attempts, andretryDelayis in seconds.onSuccessruns only after backend verification.onFailurereports a failed payment or SDK operation. Pending and unknown outcomes retain the reference for reconciliation. Callback exceptions propagate to the caller.