Answer the question
In order to leave comments, you need to log in
How can I pay for an order by its ID in Bitrix?
Good afternoon, is it possible to implement this and how best to do it?
A page with a field for entering the order number and, if the order is found, provide an opportunity to choose how it can be paid and, accordingly, pay for it in the future?
Answer the question
In order to leave comments, you need to log in
you can display the payment handler on the page in this way
$orderObj = Sale\Order::load($order['ORDER']['ID']);
$paymentCollection = $orderObj->getPaymentCollection();
$payment = $paymentCollection[0];
$service = Sale\PaySystem\Manager::getObjectById($payment->getPaymentSystemId());
$context = \Bitrix\Main\Application::getInstance()->getContext();
$service->initiatePay($payment, $context->getRequest());
<?$APPLICATION->IncludeComponent(
"bitrix:sale.order.payment",
"",
Array(
)
);?>
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
$APPLICATION->SetTitle("Оплата заказа");
ob_start();
?>
<?$APPLICATION->IncludeComponent(
"bitrix:sale.order.payment",
"",
Array(
)
);?>
<?
$formPay = ob_get_contents();
ob_end_clean();
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_after.php");
$APPLICATION->SetTitle("Оплата заказа");
?>
<div class="formPayment">
<?
echo $formPay;
?>
</div>
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>
Here is a very simple way: CSaleOrder::PayOrder($orderId, "Y");
At the same time, in the bitrix documentation, it is written about it as an obsolete method. It is also recommended to use Order
Who knows how to do the same through Order, please unsubscribe in the comments.
You can do everything (almost). Have you tried anything yourself yet? The new store has more or less api. The old one is worse.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question