POST /v1.1/devices/<terminal_id>/refund
Attribute |
Type |
Condition |
Description |
X-Request-ID |
UUID |
Mandatory |
ID of the request, unique to the call. |
Authorization |
String |
Mandatory |
The oAuth2 Bearer token |
API-Key |
String |
Mandatory |
The Client ID obtained from the myPOS Account |
Attribute |
Type |
Condition |
Description |
reference_number |
String |
Mandatory |
The reference number that was set for the original transaction. |
amount |
Decimal |
Mandatory |
The amount that will be refunded. It must be smaller or equal to the original transaction amount. |
Attribute |
Type |
Condition |
Description |
X-Request-ID |
UUID |
Mandatory |
ID of the request, unique to the call. |
Content-Type |
String |
Mandatory |
application/json |
Response body
Empty if the refund was issued successfully.
curl -X GET \
https://devices-api.mypos.com/v1.1/devices/TID/refund' \
-H 'Authorization: Bearer PLpC1CqVE9CYXolbGNBPqz0NYy8asFzG95XcToDsMP' \
-H 'Content-Type: application/json' \
-H 'API-Key: MY_API_KEY' \
-H 'X-Request-ID: 232465ab-66ea-4776-b3f0-f7a123f988e4'
--data '{
"reference_number": "123456",
"amount": 0.02
}'
import requests
headers = {
'Authorization': 'Bearer 0MdU53T8Cy2hNUuCvAYSKaTeyggN5FurfRy3c4LfGn',
'Content-Type': 'application/json',
'X-Request-ID': '232465ab-66ea-4776-b3f0-f7a123f988e4',
'API-Key': 'MY_API_KEY',
}
json_data = {
'reference_number': '123456',
'amount': 0.02,
}
response = requests.post('https://devices-api.mypos.com/v1.1/devices/TID/refund', headers=headers, json=json_data)
# Note: json_data will not be serialized by requests
# exactly as it was in the original request.
#data = '{\n "reference_number": "123456",\n "amount": 0.02\n}'
#response = requests.post('https://devices-api.mypos.com/v1.1/devices/TID/refund', headers=headers, data=data)
const request = require("request");
const options = {
method: 'POST',
url: 'https://devices-api.mypos.com/v1.1/devices/TID/refund',
headers: {
'Authorization': 'Bearer 0MdU53T8Cy2hNUuCvAYSKaTeyggN5FurfRy3c4LfGn',
'Content-Type': 'application/json',
'API-Key': 'MY_API_KEY',
'X-Request-ID': '232465ab-66ea-4776-b3f0-f7a123f988e4'
},
body: JSON.stringify({
reference_number: "123456",
amount: 0.02
})
};
request(options, (error, response, body) => {
if (error) {
console.error('Error:', error);
} else if (response.statusCode === 200) {
console.log('Response:', body);
} else {
console.log('Unexpected Status Code:', response.statusCode, body);
}
});
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post('https://devices-api.mypos.com/v1.1/devices/TID/refund', [
'headers' => [
'Authorization' => 'Bearer 0MdU53T8Cy2hNUuCvAYSKaTeyggN5FurfRy3c4LfGn',
'Content-Type' => 'application/json',
'X-Request-ID' => '232465ab-66ea-4776-b3f0-f7a123f988e4',
'API-Key' => 'MY_API_KEY'
],
// 'body' => "{\n \"reference_number\": \"123456\",\n \"amount\": 0.02\n}",
'json' => [
'reference_number' => '123456',
'amount' => 0.02
]
]);