S
S
strify_252020-07-11 19:41:15
1C-Bitrix
strify_25, 2020-07-11 19:41:15

How to set the order payment flag in Bitrix D7?

Hello. How to correctly set the order payment flag in Bitrix via api? I use the following construction:

use Bitrix\Sale\Order;

$order = \Bitrix\Sale\Order::load(1478);

$paymentCollection = $order->getPaymentCollection();
foreach ($paymentCollection as $payment) {
    if (!$payment->isPaid()) {
        $payment->setPaid("Y");
    }
}

$order->setField("STATUS_ID", "F"); // статус заказа - выполнен
$order->refreshData();
$order->save(); // сохранить заказ


In this case, the paid amount is set in full, but the payment status is not paid:
7ee27bda98.jpg

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question