如何解决创建Woocommerce订阅有问题吗?
我当前正在使用Prospress woocommerce订阅API v1 https://prospress.github.io/subscriptions-rest-api-docs 它创建订阅,但不创建相关订单。我不知道我在想什么。下面是我的代码。 我也在过去5到6天内用Google搜索,但是没有运气。
我们将不胜感激任何帮助。
$data = [
'subscription' => [
'customer_id' => $user_id,'status' => 'active','billing_period' => $parameters['billing_period'],'billing_interval' => 1,'start_date' => $start_date,'next_payment_date' => $next_payment_date,'payment_method' => 'braintree_cc','payment_details' => [
"method_id" => "braintree_cc","method_title" => "Visa 1234","paid" => "true"
],'billing_address' => $address,'shipping_address' => $address,'line_items' => [ [
'product_id' => $parameters['plan_id'],'quantity' => 1
]
],'shipping_lines' => [],]
];
$woocommerce = new Client(
'https://www.example.com','ck_xxxxx','cs_xxxx',[
'wp_api' => true,'version' => 'wc-api/v1','query_string_auth' => true // When true and using under HTTPS force Basic Authentication as query string
]
);
print_r($woocommerce->post('subscriptions',$data)); ```
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。