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.
Prerequisites
This guide assumes you have already completed:
- Refund Payments — you will need a refund ID.
- Transfer Funds to Sellers — you will need the payment transfer ID and item IDs from the original transfer.
Grab the refund id:
{
"id": "rfd_2YKewBonG4tgk12MheY3PiHDy",
"account_id": "acc_B518niGwGYKzig6vtrRVZGGGV",
"environment": "test",
...
}
And the payment transfer id and each item id from the original 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:
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
}]
}'
You should see a refund transfer result similar to:
{
"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"
}
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:
- Transfer Funds to Sellers — send funds to sellers using Payment Transfer Intents
- Search and View Transactions
- Webhooks