woocommerce - 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 );
}
}
解决方案
推荐阅读
- java - Jython: different behaviour with 'is' keyword
- android - 任何 android Studio 版本 > 3.2.1 显示红色资源但仍可编译
- c# - 如何将自定义属性添加到 IdentityServer4 PersistedGrantStore
- c++ - 以基类作为数据成员的派生类?
- identityserver4 - 是否可以调用 IdentityServer4 API 来发布令牌?
- bash - 要求输入 bash 脚本的命令
- android - Android Studio 编辑器在更新到 3.5 后看不到数据绑定引用
- java - Spring Boot 1.5 禁用 oauth2 安全性
- go - 使用反射设置作为指针的结构字段
- javascript - 如何使用 javascript 在浏览器中检索 keberos 票证