Aller au contenu
Chargement des API keys…

Payments

Initialize, retrieve, list and cancel payments via the Payments API.

The Payment (transaction) object represents a payment collection attempt. Its lifecycle goes from pending to succeeded (or failed). All routes share the base https://api.wajub.com.

Before you begin

To initialize a payment, you need a public key (pk_...) found in the Wajub dashboard.

Marketplaces: acting on behalf of a subaccount

Platforms can attribute a payment to a connected subaccount by sending an X-Sync header alongside their own key. See Subaccounts for the full contract and error cases.

Endpoints

MethodPathDescription
POST/paymentsInitialize a payment
GET/payments/{id}Retrieve a payment
GET/paymentsList payments
DELETE/payments/{id}Cancel a payment
GET/payments/{id}/refundsList refunds for a payment

The Payment object

Create response vs. retrieval response

The POST /payments (create) response includes two additional fields, authorization_url and authorization_token. That are not present on subsequent retrieval responses. These are the two most important fields in the create response.

idstringfacultatif
Unique transaction identifier, trx_ prefix followed by a ULID. This is the canonical identifier to use in all API calls (GET /payments/{id}, POST /refunds body, etc.).
authorization_urlstringfacultatif
**Returned by POST /payments only.** The hosted payment page URL to redirect your customer to. An opaque session URL, do not parse or construct it manually.
authorization_tokenstringfacultatif
**Returned by POST /payments only.** Browser-safe single-use session token scoped to this payment. Pass as sessionId to Wajub Components for embedded checkout.
referencestringfacultatif
Public transaction reference (always equal to id (same trx_xxx value). Both fields exist for historical compatibility; use id in code. Note: the merchant-supplied reference field on POST /payments is a separate concept) it is your own internal order reference, stored on the object but not used as an API identifier.
statusenumfacultatif
Current state: pending, processing, succeeded, failed, cancelled, expired, partial, refunded, partially_refunded.
amountintegerfacultatif
Amount in the major unit of the currency (e.g. 25000 = 25 000 XAF). Always an integer, no decimal values.
amount_paidinteger?facultatif
Actual amount collected (may differ from amount in partial payment scenarios).
currencystringfacultatif
ISO 4217 currency code. Accepted values: XAF (Cameroon, Chad, CAR, Congo, Gabon, Equatorial Guinea), XOF (Côte d'Ivoire, Senegal, Benin, Mali, Burkina Faso, Togo, Niger, Guinea-Bissau), NGN (Nigeria), GHS (Ghana), KES (Kenya), UGX (Uganda), TZS (Tanzania), RWF (Rwanda). Contact support for additional currencies.
channelstring?facultatif
Payment channel used (e.g. cm.mtn, cm.orange, sn.wave).
payment_methodobject?facultatif
Resolved payment method: { channel, account }.
settledbooleanfacultatif
true if funds have been credited to the available balance (credited_at is set).
descriptionstring?facultatif
Label visible to the customer on the payment page.
itemsarray?facultatif
Line items passed at initialization. Displayed on the payment page.
taxobject?facultatif
Tax details if Tax is active: { amount, taxable_amount, rate, name, country, inclusive }.
failure_reasonstring?facultatif
Machine-readable failure code (see [Failure Reasons](/api/failure-reasons)). Present only when status=failed.
customerobject?facultatif
Customer profile used for this payment.
metadataobject?facultatif
Free-form data you passed at creation.
callbackstring?facultatif
Redirect URL after payment.
sandboxbooleanfacultatif
true for test-mode transactions.
credited_atdatetime?facultatif
ISO 8601 timestamp of settlement.
created_atdatetimefacultatif
ISO 8601 creation timestamp (UTC).

Lifecycle

Events

EventTrigger
payment.createdPayment initialized
payment.processingPayment submitted to the provider
payment.succeededPayment successfully validated
payment.failedPayment failed (see failure_reason)
payment.cancelledPayment cancelled by the customer or expired

See the full event catalog for refund-specific events. A refund on a payment does not re-emit a payment.* event, it emits refund.* events instead.

Que pensez-vous de ce contenu ?