POST
/
purchases
/
{id}
/
refund
/
curl --request POST \
  --url https://gate.chip-in.asia/api/v1/purchases/{id}/refund/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "amount": 120
}'
{
  "type": "<string>",
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "created_on": 1619740800,
  "updated_on": 1619740800,
  "client": {
    "bank_account": "<string>",
    "bank_code": "<string>",
    "email": "jsmith@example.com",
    "phone": "+44 45643564564",
    "full_name": "<string>",
    "personal_code": "<string>",
    "street_address": "<string>",
    "country": "<string>",
    "city": "<string>",
    "zip_code": "<string>",
    "state": "<string>",
    "shipping_street_address": "<string>",
    "shipping_country": "<string>",
    "shipping_city": "<string>",
    "shipping_zip_code": "<string>",
    "shipping_state": "<string>",
    "cc": [
      "jsmith@example.com"
    ],
    "bcc": [
      "jsmith@example.com"
    ],
    "legal_name": "<string>",
    "brand_name": "<string>",
    "registration_number": "<string>",
    "tax_number": "<string>"
  },
  "payment": {
    "is_outgoing": true,
    "payment_type": "purchase",
    "amount": 123,
    "currency": "<string>",
    "net_amount": 123,
    "fee_amount": 123,
    "pending_amount": 123,
    "pending_unfreeze_on": 1619740800,
    "description": "<string>",
    "paid_on": 1619740800,
    "remote_paid_on": 1619740800
  },
  "transaction_data": {},
  "related_to": {
    "type": "<string>",
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  },
  "reference_generated": "<string>",
  "reference": "<string>",
  "account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "company_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "is_test": true,
  "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "brand_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}

Will generate a Payment object and return it as a successful response.

Optional amount argument can be included in the request body to request a partial refund.

Consult refund_availability field on Purchase on details whether this Purchase can be refunded or not.

If this operation takes too long to be processed on the acquirer side - you will get a response with status code 200 and a Purchase object having status = pending_refund in body (you will receive a corresponding Webhook callback too for a purchase.pending_refund event). To be notified of a successful operation completion, please subscribe to payment.refunded callback event - it will deliver a Payment generated by this refund.

If refund fails due to payment processing error, you will receive HTTP response code 400 with error code purchase_refund_error. In this case, to get more details about the error, you should perform a GET /purchase/ request for the Purchase you tried to refund. In transaction_data.attempts[] array (newest element first) you’ll find the corresponding attempt with error code and description in .error parameter.

Authorizations

Authorization
string
headerrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Object ID (UUID)

Body

application/json
amount
integer

Amount to refund in minor units of the purchase's currency - e.g. 100 for €1.00. Should not be more than Purchase.refundable_amount.

Optional; if not provided, a full refund will be executed. See the description for Purchase.refund_availability field.

Response

200 - application/json
type
string

Object type identifier

id
string
created_on
integer

Object creation time

updated_on
integer

Object last modification time

client
object

Contains details about the client of a purchase or payment - the remote payer/fund recipient party.

payment
object

Details of an executed transaction. Read-only for Purchases and Payouts. For an unpaid Purchase, this object will be null.

transaction_data
object | null

Payment method-specific, read-only, internal transaction data. Will contain information about all the transaction attempts, if available.

related_to
object | null

The object type and id this object is related to, if any. E.g. refund Payments are related to a specific Purchase, so this object will contain type: purchase and id: <purchase's id>.

reference_generated
string

If an explicit invoice reference wasn't provided, this autogenerated value will be used as a reference instead.

reference
string

Invoice reference.

account_id
string

ID of an account this Payment is associated with.

company_id
string
is_test
boolean

Indicates this is a test object, created using test API keys or using Billing section of UI while in test mode.

user_id
string | null

ID of user who has created this object in the Billing UI, if applicable.

brand_id
string

ID of the brand this Payment is associated with.