Create a Refund for a Direct Card Payment

You can initiate refunds only for transactions with a Captured payment status. When you are initiating a refund you need to provide the Refund Amount and the Merchant Transaction ID, that is automatically generated. You can change this ID by introducing your ID value.

The refunds can be full and/or partial depending if you have to return all the money to customer or not.

Full refund means you can only refund the entire captured amount for the initial transaction.

Partial refund means you have the possibility to refund a smaller amount than the one from the initial captured transaction. You can perform more than one refund for a transaction with the limitation that the sum of partial refunds to be smaller or equal than the initial captured amount.

Definition: POST /v1/payments/{id}/refunds

Where:
  • {id} – GlobalPay Payment ID

A 200 HTTP response (OK) is returned if the request was completed successfully.

Request:

POST https://securetest.smart2pay.com/v1/payments/202246/refunds
Authorization: Basic MTAxMDpnYWJp

{
 "Refund": {
   "MerchantTransactionID": "s2ptest_h19",
   "OriginatorTransactionID": "108_a",
   "Amount": 2000,   
   "Description": "refund reason"
  }
}

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8


{
  "Refund": {
    "ID": 263,
    "SiteID": 1010,
    "Created": "20161205095348",
    "MerchantTransactionID": "s2ptest_h19",
    "OriginatorTransactionID": "108_a",
    "InitialPaymentID": 202246,
    "Amount": 2000,
    "Currency": "EUR",
    "Description": "refund reason",
    "StatementDescriptor": null,
    "Customer": null,
    "BillingAddress": null,
    "BankAddress": null,
    "Articles": null,
    "Status": {
      "ID": 2,
      "Info": "Success",
      "Reasons": []
    }
  }
}

In case of an API error, an HTTP 4xx (you did something wrong) or HTTP 5xx (we did something wrong) response is returned.

For more information about the reasons of a wrong request response see our section GlobalPay Return Codes.

Request:

POST https://securetest.smart2pay.com/v1/payments/202247/refunds
Authorization: Basic MTAxMDpnYWJp

{
 "Refund": {
   "MerchantTransactionID": "s2ptest_h22",
   "OriginatorTransactionID": "109_a",
   "Amount": 1000,   
   "Description": "refund reason"
  }
}

Response:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8

{
  "Refund": {
    "ID": 266,
    "SiteID": 1010,
    "Created": "20161205095522",
    "MerchantTransactionID": "s2ptest_h22",
    "OriginatorTransactionID": "109_a",
    "InitialPaymentID": 0,
    "Amount": 1000,
    "Currency": "EUR",
    "Description": "refund reason",
    "StatementDescriptor": null,
    "Customer": null,
    "BillingAddress": null,
    "BankAddress": null,
    "Articles": null,
    "Status": {
      "ID": 4,
      "Info": "Failed",
      "Reasons": [
        {
          "Code": "2206",
          "Info": "Refund.Amount exceeds initial payment available amount"
        }
      ]
    }
  }
}