Track and manage payouts
Follow a payout through its statuses and webhook events, retrieve and list payouts, cancel a pending bank payout, and handle returns and failures.
A payout's final result can come after the response that created it. A bank payout is often pending first, and one that succeeded can still be returned. Follow each payout with webhook events, and retrieve it when you need its details.
Statuses
A payout starts as succeeded, pending, failed, or blocked. A pending payout then succeeds or fails, and one that succeeded can still be returned:
- Payout created
- succeeded, Sent
- returned, Bank sends it back
- pending, Not sent or confirmed yet
- succeeded, Sent
- returned, Bank sends it back
- failed, Declined or canceled
- failed, Declined
- blocked, Blocked by a risk rule
| Status | Meaning |
|---|---|
pending | Pay.com accepted the payout, and it's waiting to be sent or confirmed, or for funds in your balance. |
succeeded | The payout was sent. A bank payout can still come back as returned, usually within 2 business days. |
failed | The payout was declined or canceled. See its failure_code. No money reached the recipient. |
blocked | A risk rule declined the payout. |
returned | The payout succeeded, but the recipient's bank sent it back, and the funds went back to your balance. |
Events
Pay.com sends a webhook event when a payout changes status. Blocked and canceled payouts send payout.failed too, so read the payout's status and failure_code. Verify each event's signature, and skip an event you've already handled.
| Event | What to do |
|---|---|
payout.pending | Show the payout as in progress. Not every payout sends this event, so don't wait for it. |
payout.succeeded | Mark the payout as paid. For a bank payout, payout.returned can still follow. |
payout.failed | Read status and failure_code to see why. Ask the recipient for another payout method, or create a new payout. |
payout.returned | Mark the payout as unpaid, and ask the recipient for other details before you pay them again. |
Retrieve a payout
Retrieve a payout by its ID with GET /v1/payouts/{id}:
curl https://api.sandbox.pay.com/v1/payouts/po_687092287729042432 \
-u ':sk-pay-com-sandbox-…'Besides its status, the payout has these fields:
| Field | What it holds |
|---|---|
failure_code, failure_message | Why the payout failed. See Failure codes. |
underlying_network_details | For a US bank payout, the rail it used in network (ach, rtp, or fednow). An ACH payout also includes ach.trace_number, which the recipient's bank uses to trace the transfer. |
cashflow_transaction | null until the payout clears. Then the cash flow transaction that records it in your balance (see Balances and cash flow). |
underlying_processing_details | The processor's own failure code and message, and a returned payout's return_code. Present only when processor details are enabled on your account. |
To find a payout by the reference you set when you created it, call GET /v1/payouts/reference/{reference_id}.
List payouts
GET /v1/payouts lists your payouts, oldest first and 10 at a time (limit accepts up to 100). Filter by customer_reference_id or creation timestamp (created.greater_than_or_equals, created.greater_than, created.less_than_or_equals, created.less_than), and paginate with starting_after or ending_before. See Pagination and filtering.
curl -G https://api.sandbox.pay.com/v1/payouts \
-u ':sk-pay-com-sandbox-…' \
-d customer_reference_id=cust-john-smith-001 \
-d limit=25Only one list query runs at a time for your account. Another one returns 429. Retry after the number of seconds in its Retry-After header.
Cancel a payout
You can cancel a pending bank payout until it's sent to the recipient's bank, with POST /v1/payouts/{id}/cancel. A payout on an instant rail can't be canceled.
curl -X POST https://api.sandbox.pay.com/v1/payouts/po_687093012345678912/cancel \
-u ':sk-pay-com-sandbox-…' \
-H "idempotency-key: $(uuidgen)"The response is the payout, now failed with failure_code: cancelled_by_merchant, and its amount returns to your balance. A payout that can't be canceled returns 422 with Payout is not pending (if it already succeeded or failed) or Payout cannot be cancelled (if it has already been sent, or its payout method or rail doesn't support cancellation).
Returns
A bank can send back a payout that succeeded, usually within 2 business days. The payout's status becomes returned, the funds return to your balance, and Pay.com sends payout.returned. Ask the recipient for updated details before paying out again.
The bank's return code (such as R01 for ACH) appears only in underlying_processing_details.return_code, which is included when processor details are enabled on your account. To test a return, see Simulate a return.
Failure codes
Two failure codes indicate an issue on your account rather than the recipient's:
failure_code | Cause |
|---|---|
insufficient_funds | Your balance couldn't fund a bank payout created with balance_failure_on_create: true. |
cancelled_by_merchant | You canceled the payout. |
For any other failure, read failure_message. A payout declined on creation also includes the reason in error.decline_code.
Next steps
- Create a payout: Send payouts from your server with
POST /v1/payouts. - Test and go live: Test payout outcomes and simulate bank returns in the sandbox.