Refund Payment
curl --request POST \
--url https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment \
--header 'Abp-TenantId: <abp-tenantid>' \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json-patch+json' \
--header 'cap-signature: <cap-signature>' \
--data '
{
"transactionNumber": "<string>",
"reason": "Purchase wrong item",
"timestamp": 1621851652617,
"amount": 123
}
'import requests
url = "https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment"
payload = {
"transactionNumber": "<string>",
"reason": "Purchase wrong item",
"timestamp": 1621851652617,
"amount": 123
}
headers = {
"Abp-TenantId": "<abp-tenantid>",
"Authorization": "<authorization>",
"cap-signature": "<cap-signature>",
"Content-Type": "application/json-patch+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Abp-TenantId': '<abp-tenantid>',
Authorization: '<authorization>',
'cap-signature': '<cap-signature>',
'Content-Type': 'application/json-patch+json'
},
body: JSON.stringify({
transactionNumber: '<string>',
reason: 'Purchase wrong item',
timestamp: 1621851652617,
amount: 123
})
};
fetch('https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'transactionNumber' => '<string>',
'reason' => 'Purchase wrong item',
'timestamp' => 1621851652617,
'amount' => 123
]),
CURLOPT_HTTPHEADER => [
"Abp-TenantId: <abp-tenantid>",
"Authorization: <authorization>",
"Content-Type: application/json-patch+json",
"cap-signature: <cap-signature>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment"
payload := strings.NewReader("{\n \"transactionNumber\": \"<string>\",\n \"reason\": \"Purchase wrong item\",\n \"timestamp\": 1621851652617,\n \"amount\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Abp-TenantId", "<abp-tenantid>")
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("cap-signature", "<cap-signature>")
req.Header.Add("Content-Type", "application/json-patch+json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment")
.header("Abp-TenantId", "<abp-tenantid>")
.header("Authorization", "<authorization>")
.header("cap-signature", "<cap-signature>")
.header("Content-Type", "application/json-patch+json")
.body("{\n \"transactionNumber\": \"<string>\",\n \"reason\": \"Purchase wrong item\",\n \"timestamp\": 1621851652617,\n \"amount\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Abp-TenantId"] = '<abp-tenantid>'
request["Authorization"] = '<authorization>'
request["cap-signature"] = '<cap-signature>'
request["Content-Type"] = 'application/json-patch+json'
request.body = "{\n \"transactionNumber\": \"<string>\",\n \"reason\": \"Purchase wrong item\",\n \"timestamp\": 1621851652617,\n \"amount\": 123\n}"
response = http.request(request)
puts response.read_body{
"tenantId": 123,
"transactionNumber": "<string>",
"refundTransactionNumber": "<string>",
"referenceCode": "<string>",
"amount": 123,
"currencyCode": "<string>",
"refundStatus": 123,
"responseMessage": "<string>",
"paymentSessionNumber": "<string>",
"refundPaymentList": {
"transactionNumber": "<string>",
"amount": 123,
"currencyCode": "<string>",
"refundReason": "<string>",
"refundStatus": 123
}
}Refund APIs
Refund Payment
The payment gateway requests a refund payment
POST
/
api
/
services
/
app
/
PaymentGateway
/
RefundPayment
Refund Payment
curl --request POST \
--url https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment \
--header 'Abp-TenantId: <abp-tenantid>' \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json-patch+json' \
--header 'cap-signature: <cap-signature>' \
--data '
{
"transactionNumber": "<string>",
"reason": "Purchase wrong item",
"timestamp": 1621851652617,
"amount": 123
}
'import requests
url = "https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment"
payload = {
"transactionNumber": "<string>",
"reason": "Purchase wrong item",
"timestamp": 1621851652617,
"amount": 123
}
headers = {
"Abp-TenantId": "<abp-tenantid>",
"Authorization": "<authorization>",
"cap-signature": "<cap-signature>",
"Content-Type": "application/json-patch+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Abp-TenantId': '<abp-tenantid>',
Authorization: '<authorization>',
'cap-signature': '<cap-signature>',
'Content-Type': 'application/json-patch+json'
},
body: JSON.stringify({
transactionNumber: '<string>',
reason: 'Purchase wrong item',
timestamp: 1621851652617,
amount: 123
})
};
fetch('https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'transactionNumber' => '<string>',
'reason' => 'Purchase wrong item',
'timestamp' => 1621851652617,
'amount' => 123
]),
CURLOPT_HTTPHEADER => [
"Abp-TenantId: <abp-tenantid>",
"Authorization: <authorization>",
"Content-Type: application/json-patch+json",
"cap-signature: <cap-signature>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment"
payload := strings.NewReader("{\n \"transactionNumber\": \"<string>\",\n \"reason\": \"Purchase wrong item\",\n \"timestamp\": 1621851652617,\n \"amount\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Abp-TenantId", "<abp-tenantid>")
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("cap-signature", "<cap-signature>")
req.Header.Add("Content-Type", "application/json-patch+json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment")
.header("Abp-TenantId", "<abp-tenantid>")
.header("Authorization", "<authorization>")
.header("cap-signature", "<cap-signature>")
.header("Content-Type", "application/json-patch+json")
.body("{\n \"transactionNumber\": \"<string>\",\n \"reason\": \"Purchase wrong item\",\n \"timestamp\": 1621851652617,\n \"amount\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging-payments.commerce.asia/api/services/app/PaymentGateway/RefundPayment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Abp-TenantId"] = '<abp-tenantid>'
request["Authorization"] = '<authorization>'
request["cap-signature"] = '<cap-signature>'
request["Content-Type"] = 'application/json-patch+json'
request.body = "{\n \"transactionNumber\": \"<string>\",\n \"reason\": \"Purchase wrong item\",\n \"timestamp\": 1621851652617,\n \"amount\": 123\n}"
response = http.request(request)
puts response.read_body{
"tenantId": 123,
"transactionNumber": "<string>",
"refundTransactionNumber": "<string>",
"referenceCode": "<string>",
"amount": 123,
"currencyCode": "<string>",
"refundStatus": 123,
"responseMessage": "<string>",
"paymentSessionNumber": "<string>",
"refundPaymentList": {
"transactionNumber": "<string>",
"amount": 123,
"currencyCode": "<string>",
"refundReason": "<string>",
"refundStatus": 123
}
}Headers
Your unique Merchant ID assigned by CommercePay.
Your API credentials used for authentication (typically a Bearer token).
A unique security hash used to verify the integrity of the request body. See Generate Signature for how to generate this.
Body
application/json-patch+jsonapplication/jsontext/jsonapplication/*+json
Unique CAP Transaction Number
Maximum string length:
24A description for refund.
Example:
"Purchase wrong item"
new Date().getTime()
Example:
1621851652617
Please take note: The Amount parameter only accepts integer units. For example, 1000 is equivalent to 10.00 for the backend.Show all...
Example: 100
[Please pass the required amount if issuing a partial refund; ignore this attribute if issuing a full refund.]
