#rorrona

1 messages · Page 1 of 1 (latest)

languid canyonBOT
green shuttle
#

Hi, let me help you with this.

#

What do you mean by "keeps the charges" exactly?

strong stag
#

So on the end of subscription cycle, an invoice is created right? The charges was referring to this invoice

green shuttle
#

And what do you mean by "the end of subscription cycle"? Stripe Subscriptions renew by default.

strong stag
#

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.

green shuttle
#

Yes, a new Invoice will be generated for the next billing cycle.

strong stag
#

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

green shuttle
#

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?

strong stag
#

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?

green shuttle
#

our program thought there was no subscription
How is this logic defined?

strong stag
#

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

green shuttle
#

Do you check the status of the Subscription?

strong stag
#

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

strong stag
green shuttle
#

You need to check what's the status of the Subscription.

strong stag
green shuttle
strong stag
#

Or is it because the quantity becomes 0 when it is pastdue?

green shuttle
#

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?

strong stag
#

So when the susbcription_count is greater than 0, i assume that there is a subscription