Wordpress 订单状态仍然为“;待付款”;成功支付后(自定义支付网关)

Wordpress 订单状态仍然为“;待付款”;成功支付后(自定义支付网关),wordpress,woocommerce,payment-gateway,Wordpress,Woocommerce,Payment Gateway,我正在为woocommerce开发一个定制支付网关,一切都很好,但在支付成功后,订单仍然“待定支付” 在\uu construct()函数中,我检查是否有支付提供商响应 <?php //when payment done and redirected with payment reference code if(isset($_REQUEST['transaction_id'])){ paytabs_set_cookie('transaction_id', $_REQUEST['t

我正在为woocommerce开发一个定制支付网关,一切都很好,但在支付成功后,订单仍然“待定支付”

\uu construct()
函数中,我检查是否有支付提供商响应

<?php
//when payment done and redirected with payment reference code
if(isset($_REQUEST['transaction_id'])){
    paytabs_set_cookie('transaction_id', $_REQUEST['transaction_id']);
    $order  = new WC_Order($order_id);   
    $this->order = $order;
    $this->complete_transaction($order->get_id(), $_REQUEST['transaction_id']);
}
但订单状态仍为“待付款”。 现在,我需要在检查支付提供商的响应后将订单状态更改为“已完成”。

已修复

这个问题是因为这条线

wp_redirect( $this->get_checkout_order_received_url( $order ) );
它必须是
$order
而不是
$this
,因此该行如下所示

wp_redirect( $order->get_checkout_order_received_url( $order ) );
wp_redirect( $order->get_checkout_order_received_url( $order ) );