The /query.trans endpoint allows merchants to retrieve full transaction details using a previously issued PAY_REQUEST_ID. This step is optional but is often used for:
This step is **optional **but is often used for:
- Reconciliation and reporting
- Verifying transaction status if the Notify or Return step was missed
- Customer support follow-ups
You can query any transaction for up to 6 months after it was processed.
Endpoint
POST https://secure.paygate.co.za/payweb3/query.transExample request:
// Your secret encryption key
$encryptionKey = 'secret';
$data = array(
'PAYGATE_ID' => 10011072130,
'PAY_REQUEST_ID' => '23B785AE-C96C-32AF-4879-D2C9363DB6E8',
'REFERENCE' => 'pgtest_123456789'
);
$checksum = md5(implode('', $data) . $encryptionKey);
$data['CHECKSUM'] = $checksum;
$fieldsString = http_build_query($data);
// Curl request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://secure.paygate.co.za/payweb3/query.trans');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsString);
$result = curl_exec($ch);
curl_close($ch);const axios = require('axios');
const crypto = require('crypto');
const querystring = require('querystring');
// Your secret encryption key
const encryptionKey = 'secret';
const data = {
PAYGATE_ID: '10011072130',
PAY_REQUEST_ID: '23B785AE-C96C-32AF-4879-D2C9363DB6E8',
REFERENCE: 'pgtest_123456789'
};
// Generate checksum
const checksumString = Object.values(data).join('') + encryptionKey;
const checksum = crypto.createHash('md5').update(checksumString).digest('hex');
data.CHECKSUM = checksum;
// Convert to URL-encoded string
const fieldsString = querystring.stringify(data);
// Send POST request
axios.post('https://secure.paygate.co.za/payweb3/query.trans', fieldsString, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
.then(response => {
console.log('Response:', response.data);
})
.catch(error => {
console.error('Error:', error.message);
});Required Fields
| Field | Description | Type | Required |
|---|---|---|---|
| PAYGATE_ID | Your assigned PayGate ID | varchar(20) | ✅ |
| PAY_REQUEST_ID | The transaction’s unique request ID from the initiate response | varchar(36) | ✅ |
| REFERENCE | Your original transaction reference | varchar(110) | ✅ |
| CHECKSUM | MD5 hash of PAYGATE_ID + PAY_REQUEST_ID + REFERENCE + key | varchar(32) | ✅ |
Example response:
PAYGATE_ID=10011072130
&PAY_REQUEST_ID=23B785AE-C96C-32AF-4879-D2C9363DB6E8
&REFERENCE=pgtest_123456789
&TRANSACTION_STATUS=1
&RESULT_CODE=990017
&AUTH_CODE=5T8A0Z
&CURRENCY=ZAR
&AMOUNT=3299
&RESULT_DESC=Auth+Done
&TRANSACTION_ID=78705178
&RISK_INDICATOR=AX
&PAY_METHOD=CC
&PAY_METHOD_DETAIL=Visa
&CHECKSUM=f57ccf051307d8d0a0743b31ea379aa1The field structure of this response is identical to the one used in the Notify URL Response.
See the result codes section for a full list.
See the payment methods for a full list.
