Aller au contenu
Chargement des API keys…

Subaccounts

Create and manage merchant subaccounts for marketplaces and platforms.

Subaccounts let a platform connect merchants and route a share of each payment to them automatically. Part of the Sync product.

private key required

Creating and managing subaccounts requires the private key (sk...).

Endpoints

MethodPathDescription
POST/accountsCreate
GET/accounts/{id}Retrieve
GET/accountsList
PUT/accounts/{id}Update
DELETE/accounts/{id}Delete
POST/accounts/{id}/tokenRegenerate the OAuth authorization token

The Account (subaccount) object

idstringfacultatif
Unique identifier.
referencestring?facultatif
Your own reference for this sub-account.
sandboxbooleanfacultatif
true for a test-mode sub-account.
capabilitiesstring[]facultatif
Enabled capabilities for this sub-account (e.g. payment collection).
profileobjectfacultatif
Free-form profile data about the subaccount.
callbackstring?facultatif
URL the merchant is redirected to once connected. It also registers the origin: a redirect_uri on the authorization link is only honoured when it shares that origin, and refused otherwise. Without a callback, no redirect_uri is accepted.
account_typeenumfacultatif
The connection mode: direct (the merchant runs a full Wajub account), lite (a hosted portal, always collecting on the Wajub rail) or relay (no merchant account — you collect and Wajub relays the payouts). Defaults to direct, and cannot be changed afterwards.
commission_refund_policyenumfacultatif
What happens to your commission when a sale is refunded: prorata (default, in proportion to the refund), full (all of it, on the first refund) or none. Settable at creation, and editable only while the connection is pending.
statusenumfacultatif
Effective connection status.
payment_statusenumfacultatif
active or inactive, whether payment capability is currently enabled.
authorization_urlstring?facultatif
The onboarding link the merchant follows. Returned only by the two calls that mint it — creating the subaccount and regenerating its token — never by a later read. Keep it when you get it, or issue a fresh one.
masterobject?facultatif
The parent (platform) team, when loaded: { id, name }.
slaveobject?facultatif
The connected subaccount team, when loaded: { id, name, email }.
pricingobject?facultatif
Fee configuration, when loaded: { percentage_fee, fixed_fee, max_fee, currency }.
expires_atdatetime?facultatif
ISO 8601 expiry of the current authorization, if any.
created_atdatetimefacultatif
ISO 8601 creation timestamp.

Creating a subaccount

The pricing object accepts percentage_fee, fixed_fee, max_fee, min_fee (all optional, numeric), and currency (required if any fixed/min/max fee is set):

Create a subaccount
curl https://api.wajub.com/accounts \
  -H "Authorization: sk.kZ3qP8mWvL2xR7tB5nY4hC6dF9jS1aG0eU3i…" \
  -H "Content-Type: application/json" \
  -d '{
    "reference": "vendor-482",
    "capabilities": ["payments"],
    "pricing": { "percentage_fee": 10, "currency": "XAF" }
  }'

Acting on behalf of a subaccount - the X-Sync header

Once a subaccount is active, the platform can act as it by sending its id in the X-Sync header alongside the platform's own API key. When present and valid, the request runs against the subaccount's team instead of the platform's, resources are created under the subaccount, and its own pricing is applied automatically.

What the platform sees is what this connection brought: its payments, their refunds, the customers who bought through it, the payouts it sent. The merchant's own sales and other platforms' are out of scope, whatever capabilities were granted.

X-Syncheaderfacultatif
The subaccount's id (e.g. acc_7Yh2Mp), not its reference. Sent alongside the platform's Authorization key.
Create a payment on behalf of a subaccount
curl https://api.wajub.com/payments \
  -H "Authorization: sk.kZ3qP8mWvL2xR7tB5nY4hC6dF9jS1aG0eU3i…" \
  -H "X-Sync: acc_7Yh2Mp" \
  -d '{ "amount": 10000, "currency": "XAF", "email": "client@example.com" }'

On a live connection, PUT /accounts/{id} does not change capabilities or pricing outright: it answers 202 Accepted with the proposal in pending_changes, and the merchant accepts or declines it in their own dashboard. payment_status and callback still apply immediately.

Every resource states the capability it takes, and a resource that states none cannot be reached with X-Sync at all — that is the case for /accounts/*, which you always manage with your own key, and for /keys/current, which revokes your key rather than the subaccount's:

If the request touchesRequired capability
/payments, /linkspayments
/invoicesinvoices
/customers, /customers/{id}/tax_idscustomers
/refundsrefunds
/disputesdisputes
/transfers, /beneficiaries, /identitywithdrawals
/webhooks, /tax, /shieldsettings
/, /providers, /balance, /events, /listenread
/channels, /countries, /currenciesnone — catalogues
/accounts, /keys/currentnot available with X-Sync

Que pensez-vous de ce contenu ?