curl --request GET \
--url https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QueryRefund \
--header 'Abp-TenantId: <abp-tenantid>' \
--header 'Authorization: <authorization>' \
--header 'cap-signature: <cap-signature>'import requests
url = "https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QueryRefund"
headers = {
"Abp-TenantId": "<abp-tenantid>",
"Authorization": "<authorization>",
"cap-signature": "<cap-signature>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'Abp-TenantId': '<abp-tenantid>',
Authorization: '<authorization>',
'cap-signature': '<cap-signature>'
}
};
fetch('https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QueryRefund', 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/QueryRefund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Abp-TenantId: <abp-tenantid>",
"Authorization: <authorization>",
"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"
"net/http"
"io"
)
func main() {
url := "https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QueryRefund"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Abp-TenantId", "<abp-tenantid>")
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("cap-signature", "<cap-signature>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QueryRefund")
.header("Abp-TenantId", "<abp-tenantid>")
.header("Authorization", "<authorization>")
.header("cap-signature", "<cap-signature>")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QueryRefund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Abp-TenantId"] = '<abp-tenantid>'
request["Authorization"] = '<authorization>'
request["cap-signature"] = '<cap-signature>'
response = http.request(request)
puts response.read_body{
"tenantId": 123,
"transactionNumber": "<string>",
"refundTransactionNumber": "<string>",
"referenceCode": "<string>",
"amount": 100,
"currencyCode": "MYR",
"refundStatus": 11,
"responseMessage": "<string>",
"paymentSessionNumber": "<string>",
"refundPaymentList": {
"transactionNumber": "<string>",
"amount": 100,
"currencyCode": "MYR",
"refundReason": "<string>",
"refundStatus": 11
}
}{
"code": 2010,
"message": "transactionNumber does not match a transaction, or the refund hasn't been processed yet."
}Query Refund Payment
The payment gateway requests a query refund payment status
Check the status of a refund previously requested via Refund Payment. Use this to confirm whether a refund has completed, is still processing, or failed.
curl --request GET \
--url https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QueryRefund \
--header 'Abp-TenantId: <abp-tenantid>' \
--header 'Authorization: <authorization>' \
--header 'cap-signature: <cap-signature>'import requests
url = "https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QueryRefund"
headers = {
"Abp-TenantId": "<abp-tenantid>",
"Authorization": "<authorization>",
"cap-signature": "<cap-signature>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'Abp-TenantId': '<abp-tenantid>',
Authorization: '<authorization>',
'cap-signature': '<cap-signature>'
}
};
fetch('https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QueryRefund', 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/QueryRefund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Abp-TenantId: <abp-tenantid>",
"Authorization: <authorization>",
"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"
"net/http"
"io"
)
func main() {
url := "https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QueryRefund"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Abp-TenantId", "<abp-tenantid>")
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("cap-signature", "<cap-signature>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QueryRefund")
.header("Abp-TenantId", "<abp-tenantid>")
.header("Authorization", "<authorization>")
.header("cap-signature", "<cap-signature>")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging-payments.commerce.asia/api/services/app/PaymentGateway/QueryRefund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Abp-TenantId"] = '<abp-tenantid>'
request["Authorization"] = '<authorization>'
request["cap-signature"] = '<cap-signature>'
response = http.request(request)
puts response.read_body{
"tenantId": 123,
"transactionNumber": "<string>",
"refundTransactionNumber": "<string>",
"referenceCode": "<string>",
"amount": 100,
"currencyCode": "MYR",
"refundStatus": 11,
"responseMessage": "<string>",
"paymentSessionNumber": "<string>",
"refundPaymentList": {
"transactionNumber": "<string>",
"amount": 100,
"currencyCode": "MYR",
"refundReason": "<string>",
"refundStatus": 11
}
}{
"code": 2010,
"message": "transactionNumber does not match a transaction, or the refund hasn't been processed yet."
}Errors
In addition to standard signature errors, this endpoint can return:| Code | Name | Meaning |
|---|---|---|
| 2010 | TransactionNotFound | transactionNumber does not match a transaction, or (for a refund-only lookup) the refund hasn’t been processed yet. |
| 2043 | FailedToRefundQuery | The transaction’s channel/provider does not support querying refund status. |
| 2130 | ChannelNotSupportRefund | The transaction’s channel is configured to not support refunds. |
| 2160 | InvalidPaymentGatewaySetting | The channel’s provider settings are missing or misconfigured for this tenant. |
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.
Query Parameters
Unique CAP Transaction Number
24new Date().getTime()
1621851652617
Response
Success
Merchant ID.
Unique CAP Transaction Number of the original payment being refunded.
24Unique CAP Transaction Number for the refund transaction itself, distinct from the original payment's transactionNumber.
Merchant Reference Code
Please take note: The Amount parameter only accepts integer units. For example, 1000 is equivalent to 10.00 for the backend.
Invalid Format: 1,000.00
100
Currency code with a 3-letter ISO 4217 standard code
3"MYR"
Status of the refund itself (not the original payment).
| Value | Name | Meaning |
|---|---|---|
| 11 | Refunded | Refund completed successfully. |
| 12 | ProcessingRefund | Refund request accepted, being processed by the provider. |
| 13 | FailedRefund | Refund attempt failed. |
| 16 | RefundWithCharges | Refund completed, but provider/processing charges were deducted from the refunded amount. |
| 17 | RefundReverse | A previously completed refund was reversed by the provider. |
| 18 | Voided | The original transaction was voided instead of refunded, e.g. same-day cancellation. |
11, 12, 13, 16, 17, 18 Human-readable status message for the refund request.
Unique CAP Session Number
24Show child attributes
Show child attributes
