Refunds
The Refunds API allows you to create, manage, and retrieve transaction refunds seamlessly. This helps ensure your customers can receive timely refunds for any issues with their transactions.
1. Create Refund
This endpoint allows you to initiate a refund for a specific transaction using its reference or ID.
Endpoint: POST /refund
Headers
Key | Type | Value |
---|---|---|
Authorization | String | Bearer SECRET_KEY |
Content-Type | String | application/json |
Body Parameters
Key | Type | Value |
---|---|---|
transaction | String | Transaction reference or ID |
#!/bin/sh
url="https://api.paystack.co/refund"
authorization="Authorization: Bearer YOUR_SECRET_KEY"
content_type="Content-Type: application/json"
data='{ "transaction": 1641 }'
curl "$url" -H "$authorization" -H "$content_type" -d "$data" -X POST
{
"status": true,
"message": "Refund has been queued for processing",
"data": {
"transaction": {
"id": 1004723697,
"reference": "T685312322670591",
"amount": 10000,
"currency": "NGN",
"paid_at": "2021-08-20T18:34:11.000Z",
"customer_note": "Refund for transaction T685312322670591"
},
"status": "pending",
"expected_at": "2021-12-16T09:21:17.016Z"
}
}
2. List Refunds
Retrieve a list of refunds available on your integration.
Endpoint: GET /refund
Headers
Key | Type | Value |
---|---|---|
Authorization | String | Bearer SECRET_KEY |
Query Parameters
Key | Type | Value |
---|---|---|
transaction | String | (Optional) The transaction ID |
currency | String | (Optional) The currency of the refunds |
#!/bin/sh
url="https://api.paystack.co/refund"
authorization="Authorization: Bearer YOUR_SECRET_KEY"
curl "$url" -H "$authorization" -X GET
{
"status": true,
"message": "Refunds retrieved",
"data": [
{
"id": 1,
"transaction": 1641,
"amount": 500000,
"currency": "NGN",
"status": "processed",
"refunded_by": "[email protected]",
"refund_date": "2018-01-12T10:54:47.000Z"
},
{
"id": 2,
"transaction": 323896,
"amount": 500000,
"currency": "NGN",
"status": "pending",
"refunded_by": "[email protected]",
"refund_date": "2017-09-24T21:11:53.000Z"
}
]
}
3. Fetch Refunds
Retrieve details of a specific refund.
Endpoint: GET /refund
Headers
Key | Type | Value |
---|---|---|
Authorization | String | Bearer SECRET_KEY |
id | String | The ID of the refund |
#!/bin/sh
url="https://api.paystack.co/refund/:id"
authorization="Authorization: Bearer YOUR_SECRET_KEY"
curl "$url" -H "$authorization" -X GET
{
"status": true,
"message": "Refund retrieved",
"data": {
"transaction": 1641,
"amount": 500000,
"currency": "NGN",
"status": "processed",
"refunded_by": "[email protected]",
"refund_date": "2018-01-12T10:54:47.000Z"
}
}
Updated 6 days ago