Card payment refunds and discards
This is the card payments refund flow. Apple Pay and Google Pay refunds use a different endpoint and a different request — see Refunds. A card payment cannot be refunded through the mobile wallet endpoint, or the reverse.
Refund
This operation is allowed for transactions withstatus = 3 (success) or status = 4 (refund).
POST-request for an endpoint /pay/refund where two parameters are passed in the body:
data- a base64-encoded string containing JSON-document;sign- a signature which is formed on the basis of the data string using the hash_hmac function to confirm the validity of data.
The following JSON-parameters and their values form the data string:
| Parameter Name | Type | Max Length/ Precision | Description | Example |
|---|---|---|---|---|
| api_key | string | 255 | Merchant's key (identifier). It is a sensitive data | c84f1ac0-e4f0-0131-5298-70921c57c2a2 |
| transaction_id | integer | - | Transaction ID in our system | 12345678 |
| amount | integer | - | Optional. Refund amount in the currency of the payment system. If there is no parameter value, the refund is made for the entire transaction amount | 100.40 |
Example of an initial JSON-data to form the data parameter:
{
"api_key": "318dacc0-c571-0132-d48f-448a5b8820f8",
"transaction_id": "2299",
"amount": 100.8
}
Example of a decoded JSON-response:
{
"order": {
"transaction_id": 2299,
"reference": "1473747103",
"api_key": "318dacc0-c571-0132-d48f-448a5b8820f8",
"amount": "327.78",
"currency": "EUR",
"status": 4,
"status_name": "refund",
"system_amount": "327.78",
"commission": "0.0",
"system_currency": "EUR",
"payment_system_id": 1,
"payment_system_name": "CitibankB2b (TEST)",
"card_number": "411111******1111",
"processing_error_msg": null
},
"success": true,
"time_proc": "1.2sec."
}
Payment Discard
This operation is possible for transactions with status = 1 (authorize (lock amount)).
POST-request for an endpoint /pay/void where two parameters are passed in the body:
data- a base64-encoded string containing JSON-document;sign- a signature which is formed on the basis of the data string using the hash_hmac function to confirm the validity of data.
The following JSON-parameters and their values form the data string:
| Parameter Name | Type | Max Length/ Precision | Description | Example |
|---|---|---|---|---|
| api_key | string | 255 | Merchant's key (identifier). It is a sensitive data | c84f1ac0-e4f0-0131-5298-70921c57c2a2 |
| transaction_id | integer | - | Transaction ID in our system | 12345678 |
Example of an initial JSON-data to form the data parameter:
{
"api_key": "318dacc0-c571-0132-d48f-448a5b8820f8",
"transaction_id": "2299"
}
Example of a decoded JSON-response:
{
"order": {
"transaction_id": 2299,
"reference": "1473747103",
"api_key": "318dacc0-c571-0132-d48f-448a5b8820f8",
"amount": "327.78",
"currency": "EUR",
"status": 2,
"status_name": "void(unlock amount)",
"system_amount": "327.78",
"commission": "0.0",
"system_currency": "EUR",
"payment_system_id": 1,
"payment_system_name": "CitibankB2b (TEST)",
"card_number": "411111******1111",
"processing_error_msg": null
},
"success": true,
"time_proc": "1.2sec."
}