Wordpress 创建Woocommerce订阅时出现问题?
我目前正在使用prospress woocommerce订阅API v1 它创建订阅,但不创建相关订单。我不知道我错过了什么。下面是我的代码。 在过去的5-6天里,我也用谷歌搜索了一下,但是运气不好 我们将非常感谢您的帮助Wordpress 创建Woocommerce订阅时出现问题?,wordpress,woocommerce,wordpress-rest-api,woocommerce-rest-api,woocommerce-subscriptions,Wordpress,Woocommerce,Wordpress Rest Api,Woocommerce Rest Api,Woocommerce Subscriptions,我目前正在使用prospress woocommerce订阅API v1 它创建订阅,但不创建相关订单。我不知道我错过了什么。下面是我的代码。 在过去的5-6天里,我也用谷歌搜索了一下,但是运气不好 我们将非常感谢您的帮助 $data = [ 'subscription' => [ 'customer_id' => $user_id, 'status' => 'active',
$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)); ```