API Reference
Refunds API
The refunds API allows you to refund charges and retrieve the details of previous refunds.
GET /refunds
Returns a paginated list of all refunds.
Example
curl https://test-api.pinpayments.com/1/refunds -u your-secret-api-key:
200
OK
{
  "response": [
    {
      "token": "rf_ERCQy--Ay6o-NKGiUVcKKA",
      "success": null,
      "amount": 400,
      "currency": "AUD",
      "charge": "ch_bZ3RhJnIUZ8HhfvH8CCvfA",
      "created_at": "2023-10-27T13:00:00Z",
      "error_message": null,
      "status_message": "Success"
    }
  ],
  "count": 1,
  "pagination": {
    "current": 1,
    "previous": null,
    "next": null,
    "per_page": 25,
    "pages": 1,
    "count": 1
  }
}GET /refunds/refund-token
Returns the details of the specified refund.
Example
curl https://test-api.pinpayments.com/1/refunds/rf_ERCQy--Ay6o-NKGiUVcKKA -u your-secret-api-key: -X GET
200
OK
{
  "response": {
    "token": "rf_ERCQy--Ay6o-NKGiUVcKKA",
    "success": null,
    "amount": 400,
    "currency": "AUD",
    "charge": "ch_bZ3RhJnIUZ8HhfvH8CCvfA",
    "created_at": "2023-10-27T13:00:00Z",
    "error_message": null,
    "status_message": "Success"
  }
}POST /charges/charge-token/refunds
Creates a new refund and returns its details. Where the refund status returned is Pending, you can use webhooks to be notified of the refund outcome, or view it from your dashboard.
| Optional amount | The amount to refund in the currency’s base unit (e.g. cents for AUD, yen for JPY). Default value is the full amount of the charge. | 
|---|
Example
curl https://test-api.pinpayments.com/1/charges/ch_bZ3RhJnIUZ8HhfvH8CCvfA/refunds -u your-secret-api-key: -X POST
201
Created
{
  "response": {
    "token": "rf_ERCQy--Ay6o-NKGiUVcKKA",
    "success": null,
    "amount": 400,
    "currency": "AUD",
    "charge": "ch_bZ3RhJnIUZ8HhfvH8CCvfA",
    "created_at": "2023-10-27T13:00:00Z",
    "error_message": null,
    "status_message": "Pending"
  }
}Error Responses
| 402 | insufficient_pin_balance | {...} | 
|---|
GET /charges/charge-token/refunds
Returns a list of all refunds for the specified charge.
Example
curl https://test-api.pinpayments.com/1/charges/ch_bZ3RhJnIUZ8HhfvH8CCvfA/refunds -u your-secret-api-key:
200
OK
{
  "response": [
    {
      "token": "rf_ERCQy--Ay6o-NKGiUVcKKA",
      "success": null,
      "amount": 400,
      "currency": "AUD",
      "charge": "ch_bZ3RhJnIUZ8HhfvH8CCvfA",
      "created_at": "2023-10-27T13:00:00Z",
      "error_message": null,
      "status_message": "Success"
    }
  ],
  "count": 1,
  "pagination": {
    "current": 1,
    "previous": null,
    "next": null,
    "per_page": 25,
    "pages": 1,
    "count": 1
  }
} 
