WooCommerce-REST-API-Client-Library icon indicating copy to clipboard operation
WooCommerce-REST-API-Client-Library copied to clipboard

subscriptions end point

Open pocketwod opened this issue 10 years ago • 0 comments

Hello,

I apologize if this is the wrong place to ask this question, but I can't seem to find anywhere else. I cannot create a subscription after successfully creating an order via the API.

I am taking the json result from WCAPI and then sending it via POST to /subscriptions endpoint.

Here is what I get:

{ "errors": [ { "code": "woocommerce_api_cannot_create_order", "message": "Cannot create order: Invalid Subscription customer_id" } ] }

Here is what I am sending in the body of my POST:

{ "order": { "payment_details": { "method_id": "stripe", "method_title": "Credit Card", "paid": true, "transaction_id": "sk_kaljksjdflkrwerwerw" }, "billing_address": { "first_name": "Tyler", "last_name": "Thomas", "address_1": "44361 Fine Cir.", "address_2": "", "city": "Lancaster", "state": "CA", "postcode": "93536", "country": "US", "email": "[email protected]", "phone": "" }, "shipping_address": { "first_name": "Tyler", "last_name": "Thomas", "address_1": "44361 Fine Cir.", "address_2": "", "city": "Lancaster", "state": "CA", "postcode": "93536", "country": "US", "email": "[email protected]" }, "customer_id": 25, "line_items": [ { "product_id": "143", "total": "10.00", "subtotal": "10.00", "price": "10.00", "name": "Subscription Product", "sku": "ten1sub", "quantity": "1" } ], "shipping_lines": [ { "method_id": "flat_rate", "method_title": "FlatRate", "total": 10 } ] } }

pocketwod avatar Nov 20 '15 21:11 pocketwod