Recurring payment (CoF)
Recurring payment (CoF)
When working with JSON API, use the following request.
When working with HTML forms, the following changes are made relative to the initial payment:
The
wsb_recurring_tokenparameter is included in the signature after thewsb_operation_typeparameter:wsb_seedwsb_storeidwsb_customer_idwsb_order_numwsb_testwsb_currency_idwsb_totalwsb_operation_typewsb_recurring_tokenSecretKey
When receiving a request for order payment, the WEBPAY system checks the expiration date of the recurring (CoF) payment. If the subscription period has expired, the payment will not be processed. If the card subscription period is valid for this user, the service payment is processed without displaying the payment page.
<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="d1a5110dc27d38a5fed50f98def59029ed5e1564">
<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_pay">
<input type="hidden" name="wsb_recurring_token" value="123456789">
<input type="submit" value="Buy">
</form>Notification after recurring payment
After successful payment, the Merchant receives a notification with similar fields described in the previous section, with some exceptions. The request does not contain the offer_exp_date field, and accordingly, this field does not participate in the signature calculation.
Also, in response to a recurring payment request, the Merchant receives a notification.
// Response for successful recurring payment
Content-Type: application/x-www-form-urlencoded
batch_timestamp=1586712564¤cy_id=BYN&amount=15&payment_method=cc&order_id=294088281&site_order_id=ORDER-15&transaction_id=650449721&
payment_type=10&rrn=210476022664&wsb_signature=66e6be413ea2d8638174e3b69f1ffd32&action=0&rc=W0001%2800%29&approval=210476&
rc_text=Operation completed successfully&card=516052xxxxxx9495&customer_id=test_1&operation_type=recurring_pay&recurring_token=650449721
// Response for failed recurring payment
Content-Type: application/x-www-form-urlencoded
batch_timestamp=1586714748¤cy_id=BYN&amount=35&payment_method=cc&order_id=0&site_order_id=ORDER-16&transaction_id=0&payment_type=2&
rrn=&wsb_signature=25ac063bbf766c4401858439f3fbd61c&action=4&rc=W0319&approval=&rc_text=Error&card=516052xxxxxx9495&customer_id=test_1&
operation_type=recurring_bind&recurring_token=0&offer_exp_date=2022-10-31