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": "USD",
      "charge": "ch_bZ3RhJnIUZ8HhfvH8CCvfA",
      "created_at": "2012-10-27T13:00:00Z",
      "error_message": null,
      "status_message": "Pending"
    }
  ],
  "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": "USD",
    "charge": "ch_bZ3RhJnIUZ8HhfvH8CCvfA",
    "created_at": "2012-10-27T13:00:00Z",
    "error_message": null,
    "status_message": "Pending"
  }
}

POST /charges/charge-token/refunds

Creates a new refund and returns its details.

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": "USD",
    "charge": "ch_bZ3RhJnIUZ8HhfvH8CCvfA",
    "created_at": "2012-10-27T13:00:00Z",
    "error_message": null,
    "status_message": "Pending"
  }
}

Error Responses

402 insufficient_pin_balance {...}
[
  {
    "error": "insufficient_pin_balance",
    "error_description": "Refund amount is more than your available Pin Payments 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": "USD",
      "charge": "ch_bZ3RhJnIUZ8HhfvH8CCvfA",
      "created_at": "2012-10-27T13:00:00Z",
      "error_message": null,
      "status_message": "Pending"
    }
  ],
  "count": 1,
  "pagination": {
    "current": 1,
    "previous": null,
    "next": null,
    "per_page": 25,
    "pages": 1,
    "count": 1
  }
}