Refund Transaction

In this section you will learn how to process a Refund transaction

Refund Overview

The purpose of a refund transaction is to credit a transaction amount to the cardholder's account.

How to process a Refund transaction request message

The merchant's system Posts a JSON Reversal transaction message to the ANYpay Gateway. Section Card Transactions describes the elements required to build a Refund transaction request message.

📘

Key elements of a Refund transaction request message

Type MUST be set to [refund]

An example of a Refund transaction request message can be seen below.

{ 
  "merchantId": "BDD", 
  "storeId": "BDD500000005", 
  "userId": "BDDTest", 
  "type": "refund", 
  "amount": "10.00", 
  "currencyCode": "GBP", 
  "clientSystemInvoiceId": "1", 
  "clientSystemTransactionId": "1-2",
  "accountDetails": {
    "cardTokenizedNumber": "9997000000005071111"
  }  
}

Handling a Refund transaction response message

An example of an Refund transaction response message can be seen below.

{
  "id": "7890ff90-e277-4ead-a7d8-6929a3f83286",
  "state": "Authorised",
  "providerStateCode": "000",
  "providerStateMessage": null,
  "currencyCode": "USD",
  "accountDetails": {
    "cardNumber": "444433******1111",
    "tokenizedCardNumber": "9997000000005071111",
    "isVisaCheckout": null
  },
  "details": {
    "providerMerchantId": "542929008043127",
    "providerTerminalId": "00630376"
  },
  "stateDetails": {
    "approvalCode": "06268A"
  },
  "cardSecurityResponseCode": null,
  "addressVerificationResponseCode": null
}
{
  "code": "4017740",
  "details": {
    "message": "Invalid username or password"
  }
}