I don’t know how to get a specific customer active subscriptions using the Woocommerce API. I have a mobile app which connects to a middle layer, this middle layer needs to provide the list of subscriptions the user has active. I need to know what Woocommerce API endpoint or combination of endpoints I can call to get the user’s active subscriptions.
Been struggling for days to figure this out. Please help
e.g Using WooCommerce API v1 should return active subscriptions:
https://….com/wp-json/wc/v1/subscriptions?customer=1&status=active
but it doesn’t, a lot of the users have missing active subscriptions.
I have also tried:
1.
https://….com/wp-json/wc/v3/memberships/members
Though this does return the memberships, it doesn’t provide product ids, etc, with them being null for many of the memberships
“id”: 355,
“customer_id”: 1,
“plan_id”: 430,
“status”: “active”,
“order_id”: null,
“product_id”: null,
“subscription_id”: null,
2.
https://….com/wp-json/wc/v3/orders?customer=1
This is also missing subscriptions and other purchases
3
Answers
You can get active subscriptions using the following way:
You can get more information here:
https://prospress.github.io/subscriptions-rest-api-docs/?php#list-all-subscriptions
Let me know if you find it helpful.
Your Endpoint should be
/customers/<id>/subscriptions
– here<id>
iscustomer_id
WCS API function to get all the subscriptions tied to a particular customer.
You’re probably not looking for this anymore, but I figured I’d clarify the answer since @mujuonly inconveniently left out that it only applies to the
Legacy WooCommerce API
. Anyway, it’s deprecated. but it works for now.https://___.com/wc-api/v3/customers/<customer_id>/subscriptions/
As of right now, I don’t see anything like this endpoint supported in the native API. Hopefully it will be added in the near future.