Woccommerce订阅定期付款问题

时间:2021-07-14 17:00:53

标签: woocommerce payment subscription

我已经使用 API 创建了自定义支付网关。

也正在创建计划任务,它们会在适当的时候消失。我们没有看到任何费用发生,也没有生成日志。

正在购买首次订阅,并且正在从卡中扣除注册费的第一笔付款。此外,它会安排我可以在任务中看到的下一笔付款

/wp-admin/edit.php?post_type=scheduled-action

任务运行成功,但没有发生任何费用,日志中也没有任何内容 下面是我的代码

add_action( 'woocommerce_scheduled_subscription_payment_' . $this->id, array( $this, 'scheduled_subscription_payment' ), 10, 2 );

在任务开始时,我认为必须调用以下函数和未调用的借记卡。

function schedule_subscription_payment( $amount_to_charge, $order ) {

        //$result = $this->process_subscription_payment( $order, $amount_to_charge );
        $order_id = $order->get_id();
        $order->add_order_note( sprintf( __( 'Payment Attempt through schedule - %s', $this->id )));
        error_log( 'Request Args: ' . var_export( $order, true ) );
        //die();
        $result = $this->chargeCard($order_id,1);
        // error_log( 'Schedule Payment Log : ' . var_export( $result, true ) );
        if ( is_wp_error( $result ) ) {
            $order->add_order_note( sprintf( __( 'Network International subscription renewal failed - %s', $this->id )));
            WC_Subscriptions_Manager::process_subscription_payment_failure_on_order( $order, $product_id );
        } else {
            WC_Subscriptions_Manager::process_subscription_payments_on_order( $order );
        }

    }

0 个答案:

没有答案