Initial payment
Initial payment
To process an initial payment, you can use JSON API or create a form with special fields, whose values and descriptions are presented in the sections Payment form fields and Additional fields. Then redirect the customer to the payment service page using the POST method.
To enable the input of different card numbers in the test environment, the wsb_test parameter must be passed with a value of 0.
To prevent unauthorized changes, the payment form must include an electronic order signature, the wsb_signature parameter. Attempts to process payments without an electronic signature will not be processed by the payment system.
Please Note
When working with the acquiring bank "Priorbank" OJSC, it is possible to process an initial payment with a zero amount for payment card verification. To enable this feature, please contact WEBPAY support at support@webpay.by.
Please Note
To generate an electronic signature, you must set the value of the "Secret Key" (SecretKey) field in your billing account settings (you can learn more in the section Setting the Secret Key).
The signature is calculated using the following algorithm:
The specified fields must be concatenated into a single string, and the concatenation order must not be violated:
wsb_seedwsb_storeidwsb_customer_idwsb_order_numwsb_testwsb_currency_idwsb_totalwsb_operation_typeSecretKey
Then, depending on the specified protocol version (
wsb_version), calculate theMD5(if the version is not specified) orSHA1(for version2) of the concatenated string.
<form action="https://securesandbox.webpay.by/" method="post">
<input type="hidden" name="*scart">
<input type="hidden" name="wsb_version" value="2">
<input type="hidden" name="wsb_language_id" value="russian">
<input type="hidden" name="wsb_storeid" value="11111111">
<input type="hidden" name="wsb_store" value="Your Store Name">
<input type="hidden" name="wsb_order_num" value="ORDER-12345678">
<input type="hidden" name="wsb_test" value="0">
<input type="hidden" name="wsb_currency_id" value="BYN">
<input type="hidden" name="wsb_seed" value="1242649174">
<input type="hidden" name="wsb_return_url" value="http://yoursiteurl.com/success.php">
<input type="hidden" name="wsb_cancel_return_url" value="http://yoursiteurl.com/cancel.php">
<input type="hidden" name="wsb_notify_url" value="http://yoursiteurl.com/notify.php">
<input type="hidden" name="wsb_invoice_item_name[0]" value="Product 1">
<input type="hidden" name="wsb_invoice_item_quantity[0]" value="2">
<input type="hidden" name="wsb_invoice_item_price[0]" value="10">
<input type="hidden" name="wsb_invoice_item_name[1]" value="Product 2">
<input type="hidden" name="wsb_invoice_item_quantity[1]" value="1">
<input type="hidden" name="wsb_invoice_item_price[1]" value="0.5">
<input type="hidden" name="wsb_total" value="20.90">
<!-- SecretKey value in the example is 1 -->
<input type="hidden" name="wsb_signature" value="ebefd130602a41f95238b5bd5cd1f3f803456093">
<input type="hidden" name="wsb_shipping_name" value="Shipping Cost">
<input type="hidden" name="wsb_shipping_price" value="0.98">
<input type="hidden" name="wsb_discount_name" value="Product Discount">
<input type="hidden" name="wsb_discount_price" value="0.58">
<input type="hidden" name="wsb_email" value="ivanov@test.by">
<input type="hidden" name="wsb_phone" value="375291234567">
<input type="hidden" name="wsb_customer_id" value="aA1217Zz">
<input type="hidden" name="wsb_operation_type" value="recurring_bind">
<input type="submit" value="Buy">
</form>Notification after initial payment
After successful payment, the Payer receives an email with a payment receipt and subscription message. The Merchant receives a notification in the form of a specially formatted POST request. The fields contained in the notification are presented below.
| Field | Description |
|---|---|
batch_timestamp | Transaction timestamp |
currency_id | Transaction currency |
amount | Transaction amount |
payment_method | Transaction method. Possible values: cc — bank card |
order_id | Order number in the WEBPAY system |
site_order_id | Order number (name) assigned by the Merchant |
transaction_id | Transaction number |
payment_type | Transaction type. For more details, see the Transaction Types section |
rrn | Transaction number in the VISA/MASTERCARD system |
wsb_signature | Electronic signature |
action | Processing payment code |
rc | Internal WEBPAY operation result code |
approval | Processing operation code |
rc_text | Text representation of the internal WEBPAY code |
card | Masked card number used for payment and binding |
customer_id | User identifier in the Merchant system |
operation_type | Name of the performed operation:
|
recurring_token | Card binding token intended for subsequent recurring (CoF) payments |
offer_exp_date | Card expiration date in YYYY-MM-DD format (e.g., 2020-10-31) |
The wsb_signature parameter is formed according to the following rule. The values of the following fields must be concatenated into a single string, and the concatenation order must not be violated:
batch_timestampcurrency_idamountpayment_methodorder_idsite_order_idtransaction_idpayment_typerrncardcustomer_idoperation_typerecurring_tokenoffer_exp_dateSecretKey
By default, the MD5 of the string is calculated.
Please Note
If for any reason the notification was not received, but the payer claims that the payment was successful, we recommend using the GetTransactionStatus method of the API for managing card transactions or contacting WEBPAY support at support@webpay.by to clarify the operation status.