微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Woccommerce订阅定期付款问题

如何解决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 );

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

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 );
        }

    }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。