Refund Processing
note
Because a Refund is a reverse payment, the authorisation of this 'payment' is initiated by you. We refer below to the browser user, which is the merchant representative initiating this refund.
Refund Request
URL
The request is completed by a POST
to the above URL's with these headers:
HTTP Header | |||
---|---|---|---|
Field Name | State | Data Type | Description |
Content-Type | Mandatory | String | application/json |
Authorization | Mandatory | String | Bearer access_token |
And the refund
payload as shown here:
Transaction Refund | |||
---|---|---|---|
Field Name | State | Data Type | Description |
id | Mandatory | String | Id of the transaction that needs to be refunded. |
amount | Optional | Decimal | Value of transaction to refund. This value cannot be higher than the original authorisation amount. If not supplied the full original transaction amount will be refunded. |
bankId | Mandatory | String | Unique identification string assigned to the bank by Ecospend’s system. |
merchantCustomData | Mandatory | String | Address where the consumer is to be returned following a successful refund. |
Refund Response
If successful, this method returns 200 OK response code and the below response fields.
Refund Response | ||
---|---|---|
Field Name | Data Type | Description |
accountId | String | Unique reference for the store processing the transaction, as passed in the request. |
amount | Decimal | Total amount of the order including decimal places where applicable. ‘Whole’ amounts (e.g. “1”) on a GBP account represents £1.00. |
bankUrl | String | A unique and one time use only URL of the debtor's banking system. You will need to redirect a merchant to this link in order the payment to proceed. |
currency | String | Currency of the transaction GBP |
errorCode | Integer | Provides additional detail should an error have occurred with the transaction. |
id | String | Unique transaction ID. This ID should be stored as it is required for later transaction actions. |
invoiceId | String | Order/invoice/transaction/basket number generated by the host website, as passed in the request. |
rrn | String | Unique reference allocated by Ecospend. |
status | String | Ecospend payment status. |
success | Boolean | Confirms whether the transaction has been successful. |
Example Request and Response
- Request
- Response
{
"id": "9de52ca0-19ed-4467-8cdc-2c11a715d7da",
"amount": 9.99,
"bankId": "obie-coutts-sandbox",
"returnUrl": "https://test.com"
}
{
"accountId": "uuid000001",
"amount": 9.99,
"bankUrl": "https://secure1.coutts.com/as/authorization.oauth2?response_type=code%20id_token&client_id=6-BMDgK5iMenmGiMVbSOoSNz&scope=openid%20payments&redirect_uri=https://redirect.ecospend.com/redirect/&state=74916568-d38b-4357-a4cf-15a5f8f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CDdbqM2R75ron1ft2vqEHu4OtM6sLfI1PO_VwCts4jqoF59ZIFqy1aN2WnHIKKGU25kx83y8MNfUlBNFjzJjxvdFGUnr7mnFi_4cBGJ2NCGDLqSK02DcQmJUHoroOU3AbqxlIwfzZqQCTW662fXoeBimXawXOjDaLbksqRtIOSwT4FOkEj7uMxCQluOiwUA",
"currency": "GBP",
"errorCode": 0,
"id": "9de52ca0-19ed-4467-8cdc-2c11a715d7da",
"invoiceId": "1631161931484",
"rrn": "64f4ef93-539c-48cf-8ae1-f0f59a7ec3a0",
"status": "AwaitingAuthorization",
"success": true
}
Final Steps including Redirection
Like the Sale request, several steps take place outside of your interaction with us. Unlike the Sale request however, this is a shorter process with reduced requirements.
- You should redirect the browser user to the
bankUrl
returned in the Refund Response. - The browser user will then be redirected to the Bank, Ecospend and finally back to us, where we will display the payment outcome.
If you require a programmatic response, you should use our Transaction Management API to query the status of the transaction, which will provide a response as detailed here.