A
A
Alexander Ivanov2019-07-08 17:19:53
Payment systems
Alexander Ivanov, 2019-07-08 17:19:53

How to set up recurring payment in woocommerce payanyway?

https://www.payanyway.ru/info/w/ru/public/w/partne... - a description of the connection, however, not a word and recurrent payment.
Has anyone set this up? Can you advise how to set it up?
https://www.payanyway.ru/info/w/ru/public/merchant...
1. Create an invoice using the Merchant API (InvoiceRequest method) for payment using the “bank cards” method with the PAYMENTTOKEN attribute set to 'request' (string ).
2. Redirect the customer to the MONETA.Assistant form with the operationId parameter to pay the bill: https://www.payanyway.ru/assistant.htm?operationId...operationId received in the previous step. On the payment form for operations with PAYMENTTOKEN=request set, an additional "Remember card" checkbox will be displayed, requiring the user's explicit consent. If the user does not give consent, then the transaction will be processed as a regular payment and the PAYMENTTOKEN parameter will be written as refused.
https://www.payanyway.ru/info/w/ru/public/merchant... - point 5 is actually what needs to be done
and it seems that the attribute was correctly prescribed ..

// wc-payanyway.php - file

if (count($inventory)) {
$kassa_inventory = json_encode($inventory);
    // сформировать xml ответ
    header("Content-type: application/xml");
    $resultCode = 200;
    $signature = md5($resultCode . $_REQUEST['MNT_ID'] . $_REQUEST['MNT_TRANSACTION_ID'] . $this->MNT_DATAINTEGRITY_CODE);
    $result = '<?xml version="1.0" encoding="UTF-8" ?>';
    $result .= '<MNT_RESPONSE>';
    $result .= '<MNT_ID>' . $_REQUEST['MNT_ID'] . '</MNT_ID>';
    $result .= '<MNT_TRANSACTION_ID>' . $_REQUEST['MNT_TRANSACTION_ID'] . '</MNT_TRANSACTION_ID>';
    $result .= '<MNT_RESULT_CODE>' . $resultCode . '</MNT_RESULT_CODE>';
    $result .= '<MNT_SIGNATURE>' . $signature . '</MNT_SIGNATURE>';

    if ($kassa_inventory || $kassa_customer || $kassa_delivery) {
        $result .= '<MNT_ATTRIBUTES>';
    }

    if ($kassa_inventory) {
        $result .= '<ATTRIBUTE>';
        $result .= '<KEY>INVENTORY</KEY>';
        $result .= '<VALUE>' . $kassa_inventory . '</VALUE>';
        $result .= '</ATTRIBUTE>';
    }

    /** */
    // $kassa_recurring = 'request'; // Значение для PAYMENTTOKEN
    // if ($kassa_recurring) {
    //     $result .= '<ATTRIBUTE>';
    //     $result .= '<KEY>PAYMENTTOKEN</KEY>';
    //     $result .= '<VALUE>' . $kassa_recurring . '</VALUE>';
    //     $result .= '</ATTRIBUTE>';
    // }
    /** */

    if ($kassa_customer) {
        $result .= '<ATTRIBUTE>';
        $result .= '<KEY>CUSTOMER</KEY>';
        $result .= '<VALUE>' . $kassa_customer . '</VALUE>';
        $result .= '</ATTRIBUTE>';
    }

    if ($kassa_delivery) {
        $result .= '<ATTRIBUTE>';
        $result .= '<KEY>DELIVERY</KEY>';
        $result .= '<VALUE>' . $kassa_delivery . '</VALUE>';
        $result .= '</ATTRIBUTE>';
    }

    if ($kassa_inventory || $kassa_customer || $kassa_delivery) {
        $result .= '</MNT_ATTRIBUTES>';
    }

    $result .= '</MNT_RESPONSE>';

    echo $result;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmoskvin77, 2019-07-09
@dmoskvin77

There is a separate documentation regarding setting up recurrents: https ://www.payanyway.ru/info/p/ru/public/merchant...
there will be a need to store the login and password for the merchant API account in the module, and knowing the WP vulnerabilities is not safe.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question