Skip to main content

Transfer Funds from Sellers

After refunding a customer, you may need to retrieve funds from a seller back into your account using a refund transfer. Each refund may have exactly one refund transfer, whose total amount cannot exceed the refund amount.

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.

Prerequisites

This guide assumes you have already completed:

Grab the refund id:

Refund
{
"id": "rfd_2YKewBonG4tgk12MheY3PiHDy",
"account_id": "acc_B518niGwGYKzig6vtrRVZGGGV",
"environment": "test",
...
}

And the payment transfer id and each item id from the original transfer:

Payment Transfer
{
"id": "trnf_7yFLQWACr3DYDSz1xpoEAVfdq",
"account_id": "acc_B518niGwGYKzig6vtrRVZGGGV",
"environment": "test",
...
"items": [{
"id": "trfi_7yFLQWACr3DYDSz1xpoEAVfdq",
"seller_account_id": "acc_w6dogDaHuU6h1N5e5vfXLUYf",
"amount": 1000,
"transfer_fee": 100
}]
}

Create a Refund Transfer

Call the Create Refund Transfer endpoint:

Create a Refund Transfer
curl 'https://api.publicsquare.com/refund-transfers' \
-X 'POST' \
-H 'X-API-KEY: <SECRET_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"refund_id": "rfd_2YKewBonG4tgk12MheY3PiHDy",
"payment_transfer_id": "trnf_7yFLQWACr3DYDSz1xpoEAVfdq",
"items": [{
"payment_transfer_item_id": "trfi_7yFLQWACr3DYDSz1xpoEAVfdq",
"amount": 1000,
"transfer_fee": 100
}]
}'
The amount is provided in cents. 1000 is the equivalent of $10.00

You should see a refund transfer result similar to:

Refund Transfer Response
{
"id": "trnf_6Qy74FeCJxoJeXetcyTvbSnVF",
"account_id": "acc_B518niGwGYKzig6vtrRVZGGGV",
"environment": "test",
"status": "succeeded",
"refund_id": "rfd_2YKewBonG4tgk12MheY3PiHDy",
"payment_transfer_id": "trnf_7yFLQWACr3DYDSz1xpoEAVfdq",
"transaction_id": "trx_95rvMJvAVeG68W4NtLdfkN3LG",
"total_amount": 1000,
"currency": "USD",
"items": [{
"id": "trfi_4iarm41gZ1qyxDoGfEEMXyryJ",
"seller_account_id": "acc_w6dogDaHuU6h1N5e5vfXLUYf",
"payment_transfer_item_id": "trfi_7yFLQWACr3DYDSz1xpoEAVfdq",
"amount": 1000,
"transfer_fee": 100
}],
"transaction": {
"id": "trx_95rvMJvAVeG68W4NtLdfkN3LG",
"account_id": "acc_B518niGwGYKzig6vtrRVZGGGV",
"environment": "test",
"status": "succeeded",
"amount": 1000,
"fee_amount": 100,
"net_amount": 900,
"currency": "USD",
"type_id": "trnf_7yFLQWACr3DYDSz1xpoEAVfdq",
"type": "refund_transfer",
"processor": "nuvei",
"processor_id": "7110000000010554769",
"created_at": "2024-06-30T01:02:29.212Z",
"modified_at": "2024-06-30T01:02:29.212Z"
},
"created_at": "2024-06-30T01:02:29.212Z",
"modified_at": "2024-06-30T01:02:29.212Z"
}
For each item in the refund transfer, a refund transaction will be created in the seller's account.

Conclusion

Following this guide, you have successfully retrieved funds from a seller's account using a refund transfer.

Follow these guides to learn more: