EasyPay
Browse guides
DocsReference

API reference

SDK methods, configuration, payment results and transaction references.

Methods

MethodUse
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.statusMeaning
checkout_createdOpen data.checkoutUrl for hosted checkout.
otp_requiredSave the challenge server-side and prompt for an OTP.
pendingThe payment is still waiting for confirmation.
awaiting_verificationAuthorization or inline polling completed. Verify on the backend.
verifiedServer verification matched the stored order. This is the only result with success: true.
failedThe provider reported a failed or cancelled payment.
unknownA transport or transient provider error left the outcome uncertain. Reconcile the existing reference.
errorThe operation failed validation, configuration, lookup, or verification checks. Inspect message.

Configuration and callbacks

  • Switch on result.status in existing createPayment callers. Hosted initialization and public-key callbacks no longer signal settlement.
  • Pass stored expectations as the second argument to verifyTransaction(txRef, expected). Verified data includes amount, currency, mode, createdAt, the merchant txRef and the separate Chapa providerRef.
  • 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.
  • paymentOptions restricts initiation and inline or OTP authorization. An explicit txRef takes precedence over generateRefId(). The default generates a Nano ID. maxRetry counts inline polling attempts, and retryDelay is in seconds.
  • onSuccess runs only after backend verification. onFailure reports a failed payment or SDK operation. Pending and unknown outcomes retain the reference for reconciliation. Callback exceptions propagate to the caller.