#rorrona
1 messages · Page 1 of 1 (latest)
So on the end of subscription cycle, an invoice is created right? The charges was referring to this invoice
And what do you mean by "the end of subscription cycle"? Stripe Subscriptions renew by default.
What i meant by the end of subscription cycle is the end of the subscription period. So, if I start a monthly subscription today, I will get an invoice on 21 march. 21 march is what I refer as the end of subscription cycle.
Yes, a new Invoice will be generated for the next billing cycle.
Yes, so my question is that, if the payment for this invoice is delayed (failed and will retry the next day). Will the subscription be canclled?
And then later, if retrying the payment succeed, will the same subscription be continued?
Is this the behaviour of stripe subscription? Or am i misunderstanding the flow
It depends on the settings here: https://dashboard.stripe.com/settings/billing/automatic
A cancelled Subscription cannot be resumed. A Subscription where Invoice payments fail might just be marked as unpaid, depending on your settings.
Do you have a Subscription ID for me to look at?
sub_1O2YrQLwQ5i58TsBNvhgXOkh
Specifically this invoice in_1Ol9TxLwQ5i58TsBMkuoXbl6
The invoice is due on 18th, but payment go through on 19th
And our program thought there was no subscription so it allows the user to make a new one (even though the old one is still running, but just waiting for payment)
Maybe I am using the subscription list api wrongly?
our program thought there was no subscription
How is this logic defined?
So it is using subscription list api to get the subscription list of the customer. To check if the user has a subscription, it just iterates the ['data'] and checks if the ['items']['data'][0]['price']['id'] is our product. Then, it just check ms the quantity of this
I think it is better for me to wrtie the psuedocode, give me a sec
Do you check the status of the Subscription?
stripe_subscriptions = stripe.subscription.list(customer)
our_product_subscription = null
FOR stripe_subscription IN stripe_subscriptions['data'] DO
IF stripe_subscription['items']['data'][0]['price']['id'] THEN
our_product_subscription = stripe_subscription
ENDIF
DONE
IF our_product_subscription IS NOT NULL THEN
have_subscription = our_product_subscription['items']['data'][0]['quantity'] > 0
ENDIF
No checking at all, the pseudocode above accurately describes what the program does
You need to check what's the status of the Subscription.
Why do we need this?
To make sure the Subscription is active and not past_due/canceled : https://docs.stripe.com/api/subscriptions/object#subscription_object-status
But, I dont have the status checking here, so shouldnt the have_subscription be True anyway?
Or is it because the quantity becomes 0 when it is pastdue?
No, those parameters don't change.
Are you asking now why your code returned false? It's hard to say judging from pseudocode, since there might be a bug. Do you mind sharing real code?
I am making sure that I am using the api correctly because it might be that the usage is wrong. But give me a sec to fetch the real code. Is it okay if i just send a screenshot?
So when the susbcription_count is greater than 0, i assume that there is a subscription