We have: Bitrix and Yandex ticket office, when placing an order at the last stage, a link to the payment through the Yandex ticket office is formed. But how to make this link sent to the client by mail?
- Unfortunately, I did not choose the system, but the customer. - Bareza
1 answer
The formation is based on the settings of the payment system and the generated order. If you open the code inspector at the last step of ordering, you can see that there is not a link to the payment, but a form that sends a post-request to yandex, and it already forms the payment page from the transmitted data https://yadi.sk/i / NvXjQ74D6e_bag
It is possible that GET-parameters are suitable for a request at https://demomoney.yandex.ru/eshop.xml
Then the link will look like https://demomoney.yandex.ru/eshop.xml?ShopID=ΡΠ°ΠΉΡ&scid=ΡΠ΅ΠΊΡΠ΅ΡΠ½ΡΠΉ ΠΊΠΎΠ΄&customerNumber=Π½ΠΎΠΌΠ΅Ρ ΠΊΠ»ΠΈΠ΅Π½ΡΠ°&orderNumber=Π½ΠΎΠΌΠ΅Ρ Π·Π°ΠΊΠ°Π·Π°&Sum=ΡΡΠΌΠΌΠ°&paymentType=PC&cms_name=1C-Bitrix&BX_HANDLER=YANDEX&BX_PAYSYSTEM_CODE=3
Or you can try in the letter to send a form with payment. It is generated in this way (the code is taken from the standard bitrix:sale.order.ajax component bitrix:sale.order.ajax ):
use Bitrix\Main, Bitrix\Main\Loader, Bitrix\Sale, Bitrix\Sale\Order, Bitrix\Sale\PaySystem, Bitrix\Sale\Payment; Loader::includeModule("sale"); $registry = Sale\Registry::getInstance(Sale\Registry::REGISTRY_TYPE_ORDER); $orderClassName = $registry->getOrderClassName(); $order = $orderClassName::loadByAccountNumber(10);// id Π·Π°ΠΊΠ°Π·Π° if ($order->isAllowPay()) { $paymentCollection = $order->getPaymentCollection(); foreach ($paymentCollection as $payment) { $arResult["PAYMENT"][$payment->getId()] = $payment->getFieldValues(); if (intval($payment->getPaymentSystemId()) > 0 && !$payment->isPaid()) { $paySystemService = PaySystem\Manager::getObjectById($payment->getPaymentSystemId()); if (!empty($paySystemService)) { $arPaySysAction = $paySystemService->getFieldsValues(); if ($paySystemService->getField('NEW_WINDOW') === 'N' || $paySystemService->getField('ID') == PaySystem\Manager::getInnerPaySystemId()){ $initResult = $paySystemService->initiatePay($payment, null, PaySystem\BaseServiceHandler::STRING); if ($initResult->isSuccess()) $arPaySysAction['BUFFERED_OUTPUT'] = $initResult->getTemplate(); // ΠΏΠΎΠ»ΡΡΠ°Π΅ΠΌ ΡΠΎΡΠΌΡ ΠΎΠΏΠ»Π°ΡΡ ΠΈΠ· ΠΎΠ±ΡΠ°Π±ΠΎΡΡΠΈΠΊΠ° else $arPaySysAction["ERROR"] = $initResult->getErrorMessages(); } } } } } The easiest way is to send the client a link to the order page ?ORDER_ID=id Π·Π°ΠΊΠ°Π·Π° e-mail ?ORDER_ID=id Π·Π°ΠΊΠ°Π·Π° from where he can go to the payment page in one click.