💵Bank Payouts
Introduction
Sonic Payment Gateway allows merchants to easily transfer funds directly to bank accounts using our bank payouts APIs. This feature allows merchants to pay out their earnings to their own bank account or to pay their employees and contractors.
Create Bank Payout
To create a bank payout, make a POST request to the following endpoint: https://api.sonicpay.org/api/v1/payouts/bank
Include the following information in the request body:
recipient_name (string): The name of the recipient
recipient_account_number (string): The bank account number of the recipient
recipient_bank_name (string): The name of the recipient's bank
recipient_bank_code (string): The bank code of the recipient's bank
amount (number): The amount to be paid out
currency (string): The currency of the payout (e.g. USD, EUR, GBP)
metadata (object): Additional information to be associated with the payout, in key-value pairs
Example curl request:
curl -X POST https://api.sonicpay.org/api/v1/payouts/bank \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_SECRET_KEY' \
-d '{
"recipient_name": "John Doe",
"recipient_account_number": "1234567890",
"recipient_bank_name": "ABC Bank",
"recipient_bank_code": "ABC123",
"amount": 100.50,
"currency": "USD",
"metadata": {
"reference_number": "INV123"
}
}'
If the request is successful, the API will return a 200 OK response with the created bank payout object in the response body. The bank payout object will have the following properties:
id
string
The unique identifier for the bank payout
recipient_name
string
The name of the recipient
recipient_account_number
string
The bank account number of the recipient
recipient_bank_name
string
The name of the recipient's bank
recipient_bank_code
string
The bank code of the recipient's bank
amount
number
The amount of the bank payout
currency
string
The currency of the bank payout
status
string
The status of the bank payout (e.g. succeeded, failed)
metadata
object
Additional information associated with the bank payout, in key-value pairs
created_at
string
The date and time the bank payout was created, in ISO 8601 format
Get all Bank Payouts
To view all bank payouts, make a GET request to the following endpoint: https://api.sonicpay.org/api/v1/payouts/bank
You can also filter the results by passing query parameters in the request.
Examples:
To filter by country, use
country=<country_code>
To filter by currency, use
currency=<currency_code>
To filter by status, use
status=<status>
Example curl request:
curl -X GET \
https://api.sonicpay.org/api/v1/payouts/bank?country=US¤cy=USD&status=succeeded \
-H 'Authorization: Bearer <API_KEY>' \
-H 'Content-Type: application/json'
Sample response:
{
"data": [
{
"id": "b0185f8d-a9da-4d7a-9b2e-8f2e6e2b6a0c",
"amount": 1000,
"currency": "USD",
"recipient_name": "John Doe",
"recipient_account": "*******1234",
"recipient_bank": "Chase",
"status": "succeeded",
"metadata": {},
"created_at": "2022-12-01T09:00:00.000Z"
},
{
"id": "b0185f8d-a9da-4d7a-9b2e-8f2e6e2b6a0d",
"amount": 500,
"currency": "USD",
"recipient_name": "Jane Doe",
"recipient_account": "*******1235",
"recipient_bank": "Wells Fargo",
"status": "succeeded",
"metadata": {},
"created_at": "2022-12-01T09:00:00.000Z"
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 20,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Delete Bank Payout
To delete a bank payout, make a DELETE request to the following endpoint: https://api.sonicpay.org/api/v1/payouts/bank/:id
Example curl request:
curl -X DELETE \
https://api.sonicpay.org/api/v1/payouts/bank/:id \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
The API will return a 204 No Content response if the request is successful.
Update Bank Payout
To update a bank payout, make a PUT request to the following endpoint: https://api.sonicpay.org/api/v1/payouts/bank/:id Include the updated information in the request body.
Example curl request:
curl -X PUT \
https://api.sonicpay.org/api/v1/payouts/bank/:id \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"amount": 50,
"status": "processing"
}'
The API will return a 200 OK response if the request is successful, with the updated bank payout object in the response body.
Get Supported Payout Countries
To get a list of supported countries for bank payouts, make a GET request to the following endpoint: https://api.sonicpay.org/api/v1/payouts/countries
Example curl request:
curl -X GET \
https://api.sonicpay.org/api/v1/payouts/countries \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
The API will return a 200 OK response if the request is successful, with an array of country objects in the response body. Each country object will have the following properties:
code
string
The ISO 4217 currency code for the currency (e.g. USD, EUR, GBP)
name
string
The full name of the currency
Get a Payout Exchange Rate
To get the exchange rate for a specific currency, make a GET request to the following endpoint: https://api.sonicpay.org/api/v1/payouts/exchange-rate?currency=CURRENCY_CODE
Replace CURRENCY_CODE with the ISO 4217 currency code for the currency you want to get the exchange rate for.
Example curl request:
curl -X GET https://api.sonicpay.org/api/v1/payouts/exchange-rate?currency=USD -H "Authorization: Bearer YOUR_API_KEY"
The API will return a 200 OK response if the request is successful, with the following JSON object in the response body:
{
"rate": "1.234567"
}
Last updated