API Documentation

Endpoints

Paiements

Read payout history and create payout requests. Payouts are a PRO feature; on a build or install without them, these endpoints are absent or answer 501 wcusage_api_unavailable.

Warning
Changing a payout's status is bookkeeping only — no payment gateway is ever contacted. Création a payout is different: if your store has automatic payouts enabled, the normal submit flow may pay it immediately through PayPal, Stripe or Wise, exactly as a dashboard request would. The response flags this with gateway_triggered.

These are the highest-consequence endpoints in the API. Prove any automation on a staging store before pointing it at a live one, reconcile amounts against your payment provider rather than treating these figures as an accounting record, and keep the responsibility for verifying payments with a person. If you would rather nothing automated could ever create a payout, switch the /payouts endpoints off on the API screen — everything else keeps working.

List payouts

GET /wp-json/wcusage/v2/payouts

Permission: any authenticated user, read scope. Non-admins are always restricted to their own payouts, whatever user_id they send.

ParamTypeDescription
user_idintegerFilter by affiliate. Admin only — overridden for everyone else.
coupon_idintegerFilter by coupon.
statusstringOne of pending, created, paid, cancel.
from / todateFilter by request date.
page / per_pageintegerStandard pagination.
{
  "id": 321,
  "user": { "id": 1456, "display_name": "Sarah J" },
  "coupon_id": 8338,
  "coupon_code": "sarah10",
  "amount": 40.46,
  "method": "PayPal",
  "method_type": "paypal",
  "status": "pending",
  "has_details": true,
  "transaction_id": "",
  "invoice_id": 0,
  "date": "2026-08-07T09:00:00",
  "date_paid": null
}
Note
Payout destination details — PayPal addresses, bank accounts, wallet addresses — are never returned by the API. Only the boolean has_details tells you whether any are stored.

Get one payout

GET /wp-json/wcusage/v2/payouts/{id}

Permission: admin or the payout's owner. read scope. Somebody else's payout answers 404.

Request a payout

POST /wp-json/wcusage/v2/payouts

Permission: admin (any coupon), or the coupon's affiliate (their own). write scope.

Body paramTypeDescription
coupon_idintegerRequired. The coupon's full unpaid balance is requested; there is no partial-amount parameter.
curl -X POST https://example.com/wp-json/wcusage/v2/payouts \
  -H "Authorization: Bearer wcus_..." \
  -H "Content-Type: application/json" \
  -d '{"coupon_id": 8338}'

Returns 201 with the created payout, plus two extra fields:

  • gateway_triggeredvrai when auto-accept moved the payout straight to created ou paid, meaning a real gateway may have been called.
  • gateway_notice — present only when a gateway handler produced a message worth passing on.

Idempotency

Only one open request can exist per coupon at a time. If one already exists (pending, created ou traitement), the existing payout is returned with 200 and the header X-WCUsage-Existing: 1 — so a retrying client can never create duplicates. Concurrent requests for the same coupon are serialised with a lock; the loser gets 409 wcusage_api_in_progress.

Rules that are enforced

Requests are held to the same rules as the affiliate dashboard, so the API cannot be used to route around a store's configuration:

Error codeCondition
payouts_disabledPayouts are switched off in the plugin settings.
requests_disabledAffiliate self-service requests are switched off; only the store owner creates payouts. Not applied to admin callers.
no_affiliateThe coupon has no affiliate assigned.
no_balanceThe unpaid balance is zero or less.
below_thresholdThe unpaid balance is under the store's minimum payout threshold. Enforced for admins too.
no_payout_detailsThe affiliate has not saved payout details and the store requires them.
method_disabledThe affiliate's saved payout method is no longer enabled on the store. Not applied to admin callers.
invoice_requiredThe store requires an invoice upload for this payout method. Invoices cannot be uploaded through the API, so the request must be made from the affiliate dashboard.
not_createdEverything checked out but the site refused the request — typically a custom wcusage_before_payout_submit filter, or a failed write.

Update payout status

POST /wp-json/wcusage/v2/payouts/{id}/status

Permission: admin, write scope.

Body paramTypeDescription
statusstringRequired. One of pending, created, paid, cancel.

This runs the same status flow as the admin screen: balances move between the unpaid, pending-payout and paid pools, the activity log records the change, notification emails are sent and webhooks fire. No payment gateway is contacted.

Permitted transitions

FromTo
pendingpaid, cancel, created
createdpaid, cancel, pending
paidcancel, pending, created
cancelpending, created

Anything else is refused with 400 wcusage_api_invalid_transition rather than leaving the balances inconsistent. Setting the status a payout already has returns 400 wcusage_api_no_change.

Note
traitement et failed are deliberately not accepted. Nothing in the plugin writes them and the status arithmetic has no branch for them, so moving a payout through either one would strand its balance with no way back.

Two further guards:

  • Re-opening a cancelled payout takes its amount back out of the unpaid balance. If that money is no longer there — already paid out, or the balance was edited — the request is refused with 409 wcusage_api_insufficient_unpaid rather than letting the ledger drift.
  • Concurrent status changes are settled by a conditional update. Only the request that actually changes the row runs the balance arithmetic; the loser gets 409 wcusage_api_conflict.