#V3NG3ANC3

1 messages ยท Page 1 of 1 (latest)

still terraceBOT
calm cloak
#

Why is your integration creating a 2nd subscription for a renewal?

#

Can you share the sub_xxx ID for the first subscription?

#

I want to figure out why the automatic renewal is failing

ruby otter
#

The automatic renewal isn't failing, it's succeeding on the stripe side, the issue is, I'm unable to update my side of things as I'm not able to cross reference the renewed subscription.

For example, when a subscription expires, it cancels the original subscription, and creates a new one (which I'm guessing is expected). The customer ID for example on the first subscription would be cus_123, and the renewed subscription would have a customer ID of cus_321, is this normal?

calm cloak
#

But why is the subscription expiring? That shouldn't happen unless explicitly canceled

#

Can you share some IDs please

#

For example, when a subscription expires, it cancels the original subscription, and creates a new one (which I'm guessing is expected). The customer ID for example on the first subscription would be cus_123, and the renewed subscription would have a customer ID of cus_321, is this normal?
Depends on how you're integrating/creating subscriptions.

ruby otter
#

I'm logging into the stripe website and setting the expiry date to the next day for testing (I'm using test mode) what could I do to ensure the the customer ID does not change when a subscription is being renewed? Surely as its the same customer it shouldn't change anyway?

calm cloak
#

It shouldn't, no. But I suspect what you're describing as a 'renewal' isn't actually a renewal

#

But I can't really confirm without some object IDs for me to look at

ruby otter
#

OK, I'm just logging into the database now, what object IDs would you need?

calm cloak
#

The sub_xxx ID of the subscription(s)

ruby otter
#

When I created the subscription, it was
sub_1Lk5IwE0UCR6EQ1L6i8JWweC

the renewed ID is
sub_1LjiB1E0UCR6EQ1LHYPwILFK

calm cloak
#

Taking a look!

#

That's a terminal state. You can't recover that Subscription, so it's only possible to create a new subscription at that point

ruby otter
#

When for example a monthly subscription expires after a month, does it not automatically cancel that subscription and create a new one?

calm cloak
#

You didn't pass the customer parameter when creating that session, so Checkout created a new Customer object for you:

If blank for Checkout Sessions in payment or subscription mode, Checkout will create a new Customer object based on information provided during the payment flow.
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-customer

calm cloak
#

The same Subscription object would exist for the duration of the subscription until it is either canceled, lapses (according to your settings for failed payments)

ruby otter
#

how could I go about simulating a subscription expiration for testing?

calm cloak
#

Can you define what you mean by 'expiring'?

ruby otter
#

I basically want to test it by creating a subscription (1 month) then fast forwarding to the end of that 30 day period in which the subscription ends and gets renewed

covert flame
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

ruby otter
#

I haven't seen this before, thanks! Ill read up on it now ๐Ÿ™‚

covert flame
#

sure thing

#

let me know if you need any more help

ruby otter
#

can I add an existing customer/ subscription to the test clock?

#

I've created a subscription via my website, which has updated my website model, now I would like to use that same subscription I've created and use that with the test clock, but the only option I see is to add a new customer rather than an existing one

covert flame
#

you'd have to create a new customer and a new subscription

ruby otter
#

That's a shame, is there a way of simulating this without a test clock on a live subscription?

covert flame
#

test clocks are only available in test mode

#

you should never use them on a live subscription

ruby otter
#

I am in test mode

covert flame
#

but you can replicate the subscription and backdate it and everything

ruby otter
#

I just want to test that when my subscription expires, it correctly updates the seperate models on my own database

covert flame
#

so it would be the same

#

as using that other subscription

#

and since you're in test mode I don't see the issue with creating a new customer/subscription

ruby otter
#

Just because I know everything works on stripes side, I just want to check that I've set my webhook up correctly to update my seperate database

covert flame
#

yes you can create a new customer with a test clock and recreate all of the steps and test your webhook

#

or even use Stripe CLI to trigger some events for you