#Asad
1 messages · Page 1 of 1 (latest)
You may use Customer Retrieval API and expand subscriptions [0] field to retrieve the subscriptions on the customer, then find the latest created [1] timestamp from the subscription list
[0] https://stripe.com/docs/api/customers/object#customer_object-subscriptions
[1] https://stripe.com/docs/api/subscriptions/object#subscription_object-created
Yeah i've tried this,but i didn't recieved any subscription object with subscribed customers.
You'd need to expand the subscriptions field in customer retrieval request: https://stripe.com/docs/api/expanding_objects
expand: ['subscriptions']
By default, subscriptions field is not included in the response unless it's expanded
Like this ?
stripe.Customer.retrieve("cus_LsI5I8LDqi9rrY",expand: ['subscriptions'])
It should be something like this:
stripe.Customer.retrieve("cus_xxx", {
expand: ['subscriptions']
})
let me try this
i got this "error": "Invalid API Key provided: {'expand****************s']}"
m using python for ths
Could you share the request ID (req_xxx) where you see this error? Here’s how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
it's likely thrown from the library itself. let me double check right way to do in python
thanks
got it
it worked
stripe.Customer.retrieve("cus_*******", expand= ['subscriptions'])
Now my question is how can i retrieve the latest one?
can i change the next billing date?
Stripe doesn't provide filtering logic for this, so you'd need to check created timestamp of each subscription for the latest created one
can i change the next billing date?
can i change the next billing date?
Yes, it can be done withbilling_cycle_anchorparameter. You may refer to this doc for more information: https://stripe.com/docs/billing/subscriptions/billing-cycle
i saw that was the date when it was billed
Subscription billing is on the cycle. Could you share the use case why you'd change the billing date instead of billing cycle?
If a user had signup with Yearly premium package and lets say after 2 days he just upgrades his membership to paid. then the next billing date should be at 1 year + 12 days (left from trial)
When the user signs up for the yearly package, is the user given 14 days trial?
Are you using the trial function with Stripe (https://stripe.com/docs/billing/subscriptions/trials), or do you implement it on your own?
If you use the trial function by Stripe, the next billing date of subscription will just be 1 year + 14 days from the intial subscription creation, i.e. extending the trials days