首页 > 解决方案 > Woccommerce 订阅定期付款问题

问题描述

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

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

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

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

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

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

在任务开始时,我相信必须调用以下函数并且没有调用收费卡。

功能预定订阅付款($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 );
        }

    }

标签: woocommercepaymentsubscription

解决方案


推荐阅读