Customer and Admin order notifications does not work

Hello,
I have created a custom payment method using the Leasing API. Everything works fine, except the buyer and the administrator do not receive notifications about the completed order. I’ve read a lot of advice why it might not work, I’ve tried everything, but the problem remains.
In my_custom_payment.php

if (defined(‘PAYMENT_NOTIFICATION’)) {
if ($mode == ‘return_url’ && !empty($_REQUEST[‘order_id’])) {
//my custom code which working fine
// at the end for the finish order i use:
$pp_response = [
‘order_status’ => $new_status_id, // is defined before
‘reason_text’ => $text_result_deal, // is defined before
];
if (fn_check_payment_script(‘my_custom_payment.php’, $order_id)) {
fn_finish_payment($order_id, $pp_response, true);
fn_order_placement_routines(‘route’, $order_id, true);
}
}
}
Notification email does not sent.

If I try for example C.O.D. payment notifications send successfully. So email settings is fine.
Order states are changed by API. No messages are sent.
Where can be a problem?

Is the order status changed correctly with your code?

Yes order status changing correctly. I have test with all possible combinations which can be returned from API and order status changing correctly.

I noticed that the notifications does not triggering when using a callback link from an API that is being posted asynchronous… What to do in this case?

Thanks for all.
I found a solution:

$force_notification = array(‘C’ => true, ‘A’ => true, ‘V’ => true);
fn_change_order_status($order_id, $pp_response[‘order_status’], ‘’, $force_notification);

1 Like