Отвязка карты
Отвязка карты
Для осуществления отвязки карты от рекуррентных (CoF) платежей с помощью JSON API следует использовать следующий запрос.
При работе с HTML-формой запрос на отвязку карты от рекуррентных (CoF) платежей должен состоять из следующего набора полей:
wsb_versionwsb_seedwsb_storeidwsb_customer_idwsb_operation_typewsb_recurring_tokenwsb_signature
Параметр wsb_signature вычисляется путем объединения в одну строку, следующих полей:
wsb_seedwsb_storeidwsb_customer_idwsb_operation_typewsb_recurring_tokenSecretKey
Порядок объединения полей не должен быть нарушен. Далее в зависимости от указанной версии протокола (wsb_version), считается MD5 (если версия не указана), либо SHA1 (для версии 2) объединенной строки.
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<?php
$secret_key = 'jPwe3d5nmN';
$wsb_storeid = '507990464';
$wsb_seed = time();
$wsb_customer_id = '111333';
$operation_type = 'recurring_unbind';
$wsb_recurring_token = 904928145;
$wsb_signature = sha1($wsb_seed.$wsb_storeid.$wsb_customer_id.$operation_type.$wsb_recurring_token.$secret_key);
?>
<body>
<form action="http://securesandbox.webpay.by" method="post" target="_blanc">
<input type="hidden" name="*scart">
<input type="hidden" name="wsb_version" value="2" />
<input type="hidden" name="wsb_seed" value="<?=$wsb_seed?>">
<input type="hidden" name="wsb_storeid" value="<?=$wsb_storeid?>">
<input type="hidden" name="wsb_customer_id" value="<?= $wsb_customer_id ?>">
<input type="hidden" name="wsb_operation_type" value="<?= $operation_type ?>">
<input type="hidden" name="wsb_recurring_token" value="<?= $wsb_recurring_token ?>">
<input type="hidden" name="wsb_signature" value="<?= $wsb_signature ?>">
<input type="submit" value="Отказ от подписки на рекуррентные платежи">
</form>
</body>
</html>Оповещение после отвязки карты от рекуррентных платежей
После каждого запроса на отвязку система WEBPAY отправляет ответ об успешной либо ошибочной отвязке.
// пример ответа об успешной отвязке
{"batch_timestamp":1586734397,"customer_id":"test_1","operation_type":"recurring_unbind","recurring_token":"606799416","rc":"0",
"rc_text":"Operation success"}
// пример ответа об ошибке
{"batch_timestamp":1586734514,"customer_id":"test_12","operation_type":"recurring_unbind","recurring_token":"606799416","rc":"1018",
"rc_text":"Operation failed"}