Payment verification
Payment verification
Before delivering goods (or providing services), the online resource is required to verify the customer's payment.
To verify a payment upon return to the page specified in the wsb_return_url field, you must execute the billing API command get_transaction (for internet acquiring only).
Please note that requests to the test environment must be sent to https://sandbox.webpay.by, and to the production environment to https://billing.webpay.by.
$postdata = '*API=&API_XML_REQUEST='.urlencode('
<?xml version="1.0" encoding="ISO-8859-1" ?>
<wsb_api_request>
<!-- Method name -->
<command>get_transaction</command>
<authorization>
<!-- WEBPAY account username -->
<username>your_username</username>
<!-- WEBPAY account password, encrypted using MD5 -->
<password>your_md5_password</password>
</authorization>
<fields>
<!-- Transaction ID for verification.
The value is provided in the notification -->
<transaction_id>123456789</transaction_id>
</fields>
</wsb_api_request>
');
$curl = curl_init ("https://sandbox.webpay.by");
curl_setopt ($curl, CURLOPT_HEADER, 0);
curl_setopt ($curl, CURLOPT_POST, 1);
curl_setopt ($curl, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 0);
$response = curl_exec ($curl); curl_close ($curl);
echo $response;The request execution result is an XML document containing the following fields:
| Field | Description |
|---|---|
transaction_id | Transaction number |
batch_timestamp | Transaction timestamp |
currency_id | Transaction currency |
amount | Transaction amount |
payment_method | Transaction method. Possible values:
|
payment_type | Transaction type. Successful payments correspond to values: 1 and 4 |
order_id | Order number in the WEBPAY system |
rrn | Transaction number in the VISA/MASTERCARD/BELCART system |
wsb_signature | Electronic signature (calculated if a Secret Key is specified in the user account settings) |
wsb_signature is a hexadecimal sequence and is the result of the MD5 function. The input for the MD5 function is a text string obtained by simple concatenation of the following fields in the specified order:
transaction_idbatch_timestampcurrency_idamountpayment_methodpayment_typeorder_idrrnSecretKey
Please Note
If no response is received from the WEBPAY system for any reason, we recommend resending the request with increasing intervals up to 1 hour. If the WEBPAY system still does not respond, mark such operations and forward them to support@webpay.by.