WooCommerce订阅API对接Authorize.net续订支付令牌无效如何解决
问题根因
你提交的请求参数里存在低级拼写错误,是导致续订失败的直接原因:
payment_details.post_meta下的_wc_authorize_net_cim_payment_profile_id键名末尾多了一个多余的空格,WooCommerce Authorize.net支付扩展读取支付配置时无法匹配到正确的键值,因此判定支付令牌缺失。
修正方案
- 首先删除该键名末尾的多余空格,保证所有支付相关meta键名完全和官方要求一致
- 你也可以将支付相关的meta字段直接放在顶级
meta_data数组中,兼容性更强,避免嵌套层级读取异常
正确的参数示例
你可以将支付相关配置修改为如下结构:
{ "customer_id": 80595, "status": "active", "billing_period": "month", "billing_interval": 3, "start_date": "2021-10-08 19:45:00", "next_payment_date":"2021-10-08 19:48:00", "payment_method": "authorize_net_cim_credit_card", "billing": { "first_name": "check6", "last_name": "check6", "address_1": "check6", "address_2": "", "city": "San Francisco", "state": "CA", "postcode": "94103", "country": "US", "email": "check6@example.com", "phone": "(555) 555-5555" }, "shipping": { "first_name": "check6", "last_name": "check6", "address_1": "check6", "address_2": "", "city": "San Francisco", "state": "CA", "postcode": "94103", "country": "US" }, "line_items": [ { "product_id": 33704, "quantity": 3 } ], "shipping_lines": [ { "method_id": "flat_rate", "method_title": "Flat Rate", "total": "10" } ], "meta_data": [ { "key": "_custom_subscription_meta", "value": "custom meta" }, { "key": "_wc_authorize_net_cim_credit_card_customer_id", "value": "901961001" }, { "key": "_wc_authorize_net_cim_payment_profile_id", "value": "901782940" }, { "key": "_wc_authorize_net_cim_credit_card_payment_token", "value": "901782940" } ] }
额外验证点
- 确认你使用的Authorize.net Customer Profile ID、Payment Profile ID均为有效状态,没有在Authorize.net后台被删除或禁用
- 确认WooCommerce Authorize.net支付扩展、WooCommerce订阅插件均更新到最新稳定版本,避免旧版本的参数兼容问题
内容的提问来源于stack exchange,提问作者Malcolm Salvador
相关产品推荐
相关产品推荐

