curl --request GET \
--url https://staging-payments.commerce.asia/api/services/app/PaymentGateway/Query \
--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/Query"
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/Query', 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/Query",
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/Query"
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/Query")
.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/Query")
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{
"transactionNumber": "<string>",
"paymentSessionNumber": "<string>",
"referenceCode": "<string>",
"status": 0,
"settlementStatus": 0,
"currencyCode": "MYR",
"amount": 100,
"channelId": 123,
"providerTransactionNumber": "<string>",
"creationTime": "2022-02-10T08:50:30.565Z",
"remark": "<string>",
"providerChannelId": "<string>",
"providerPaymentMethod": "<string>",
"providerErrorMessage": "<string>",
"loyaltyType": 1,
"loyaltyId": 123,
"redemptionPoint": 123,
"redemptionAmount": 123,
"rewardPoint": 123,
"paidAmount": 100,
"loyaltyRedemptionStatus": 0,
"loyaltyRewardStatus": 0
}{
"code": 2010,
"message": "Neither transactionNumber nor sessionNumber resolves to a record."
}Query Payment
Payment gateway checks the existing payment status.
The following input parameters are expected to be provided by the merchant to verify transaction status or to obtain more details on the payment before approving the customer’s order.
curl --request GET \
--url https://staging-payments.commerce.asia/api/services/app/PaymentGateway/Query \
--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/Query"
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/Query', 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/Query",
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/Query"
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/Query")
.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/Query")
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{
"transactionNumber": "<string>",
"paymentSessionNumber": "<string>",
"referenceCode": "<string>",
"status": 0,
"settlementStatus": 0,
"currencyCode": "MYR",
"amount": 100,
"channelId": 123,
"providerTransactionNumber": "<string>",
"creationTime": "2022-02-10T08:50:30.565Z",
"remark": "<string>",
"providerChannelId": "<string>",
"providerPaymentMethod": "<string>",
"providerErrorMessage": "<string>",
"loyaltyType": 1,
"loyaltyId": 123,
"redemptionPoint": 123,
"redemptionAmount": 123,
"rewardPoint": 123,
"paidAmount": 100,
"loyaltyRedemptionStatus": 0,
"loyaltyRewardStatus": 0
}{
"code": 2010,
"message": "Neither transactionNumber nor sessionNumber resolves to a record."
}
- Live queries are conditional. A provider is only queried in real time when the stored status is
Pending,Authorized, orInstallmentInProgress. For any other stored status (alreadySuccess,Failed, etc.), the last known status is returned immediately without a provider round-trip.- Querying by
SessionNumberalone returns a session-level result, not one fixed transaction. Up to 3 pending transactions under that session are checked in order; the first one foundSuccessis returned. If none are, the response reflects the session’s own status withtransactionNumber: nullrather than any individual transaction.
Errors
In addition to standard signature errors, this endpoint can return:| Code | Name | Meaning |
|---|---|---|
| 2010 | TransactionNotFound | Neither transactionNumber nor sessionNumber resolves to a record. |
| 2014 | ChannelNotAllowedQuery | The transaction’s channel/provider does not support status queries. |
| 2116 | QueryProviderError | The live provider query failed, timed out, or threw an error. |
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 CommercePay Transaction Number (Conditional: If it is query for specific transaction in either normal transaction or session transaction, then need pass the transaction number)
24new Date().getTime()
1621851652617
Unique CommercePay Session Number (Conditional: If the query is query the session, then need pass the session number)
24Response
Success
Unique CommercePay transaction number
24Unique CommercePay session number
24Merchant Reference Code
50| Value | Name | Meaning |
|---|---|---|
| 0 | Pending | Transaction is pending. |
| 1 | Success | Transaction completed successfully. |
| 2 | Failed | Transaction failed. |
| 3 | Cancelled | Transaction was cancelled. |
| 4 | TransactionLimitExceeded | Transaction exceeded the allowed limit. |
| 5 | MinTransactionAmountNotMeet | Transaction amount is below the minimum allowed. |
| 6 | InsufficientFunds | Customer's account had insufficient funds. |
| 7 | InvalidTransaction | Transaction is invalid. |
| 8 | UserCancelled | Customer abandoned or cancelled the transaction at the provider. |
| 9 | Authorized | Pre-auth held, not yet captured. |
| 10 | TransactionExpired | Transaction expired before completion. |
| 11 | Refunded | Transaction was refunded. |
| 12 | ProcessingRefund | Refund is being processed. |
| 13 | FailedRefund | Refund attempt failed. |
| 14 | ProcessingTimeOut | Provider did not respond in time. |
| 15 | Verified | Transaction was verified. |
| 16 | RefundWithCharges | Refunded, but provider/processing charges were deducted from the refunded amount. |
| 17 | RefundReverse | A previously completed refund was reversed by the provider. |
| 18 | Voided | Transaction was voided. |
| 19 | Cancelling | Cancellation is in progress. |
| 20 | InstallmentInProgress | Transaction is being processed as an installment plan. |
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 0 = Unsettled, 1 = Settled, 2 = InProgress, 3 = Locked, 4 = CompleteProcessing
0, 1, 2, 3, 4 Currency code with a 3-letter ISO 4217 standard code
3"MYR"
This is Request Amount.
100
Refer to endpoints in Get Channel List
Provider Transaction Number
Payment Transaction Creation Time
"2022-02-10T08:50:30.565Z"
A description that additional information or clarify details for the transaction.
An identifier that represents the payment provider channel
Provider Payment Method
Provider Error Message
[Conditional for Loyalty Payment]
1 = BCard
1 [Conditional for Loyalty Payment] Identifier of the loyalty provider used for this transaction.
[Conditional for Loyalty Payment] Redemption Point.
[Conditional for Loyalty Payment] Redemption Amount.
[Conditional for Loyalty Payment] Reward Point.
[Conditional for Loyalty Payment] This is Paid Amount.
100
[Conditional for Loyalty Payment]
0 = Pending, 1 = Success, 2 = Failed, 3 = Void
0, 1, 2, 3 [Conditional for Loyalty Payment]
0 = Pending, 1 = Success, 2 = Failed, 3 = Void
0, 1, 2, 3 