Skip to main content

Cancel Payouts

There may be scenarios in which you need to cancel a payout, such as paying a customer or vendor by mistake.

PublicSquare API offers the ability to cancel a payout before it is settled.

Getting Started

To get started, you will need a PublicSquare Account.

Get your Secret Key

Next you will need your Secret Key. Go to your Developers section and click Reveal for your Secret Key and copy the value.

Save the Secret Key as it will be used in the next steps of this guide.

Cancel the Payout

In order to cancel a payout, we will need the ID of a recently created payout. Assuming you have a payout similar to:

Authorized Payment
{
"id": "pyt_24NFPd3jSZFTxiaH9UwjuqNdP",
"account_id": "acc_B518niGwGYKzig6vtrRVZGGGV",
"environment": "test",
"status": "pending",
...
}

We need to make a call to Cancel Payout endpoint:

Create a Payment
curl 'https://api.publicsquare.com/payouts/cancel' \
-X 'POST' \
-H 'X-API-KEY: <SECRET_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"payout_id": "pyt_24NFPd3jSZFTxiaH9UwjuqNdP"
}'

Payout Response

Given the above examples, you should see a cancelled payout result similar to:

{
"id": "pyt_24NFPd3jSZFTxiaH9UwjuqNdP",
"account_id": "acc_B518niGwGYKzig6vtrRVZGGGV",
"environment": "test",
"status": "cancelled",
"transaction_id": "trx_6QgmXzQzk3S5K5EsR3DfEiMRj",
"amount": 1000,
...
"transaction": {
"id": "trx_6QgmXzQzk3S5K5EsR3DfEiMRj",
"account_id": "acc_B518niGwGYKzig6vtrRVZGGGV",
"environment": "test",
"status": "cancelled",
"amount": -1000,
"fee_amount": 0,
"net_amount": -1000,
...
},
...
}

Handling Cancellation Failures

If a payout cannot be cancelled because the payout has already been settled, an error response will be returned:

{
"title": "Error",
"status": 400,
"detail": "payout cancellation failed."
}

Conclusion

This guide showed you how to cancel a payout.

Follow these guides to learn more: