#StefanG-subscription

1 messages · Page 1 of 1 (latest)

devout prawn
#

Hi there!

neat dagger
#

Hello!

devout prawn
neat dagger
#

yea, i have seen test clocks, but I do not know how to use them on my implementation

#

They ask me to create products and stuff to test on that

#

What I want to test really is: When I make a payment for a subscription with session checkout, when the next cycle is over, what happens to that payment

#

I want to somehow test subscriptions and the webhook that I have already created. In the test clocks, it seems that it does not redirect back to my app, it is just an independent testing environment, from what I understand anyway.

#

or what I want is simply not possible?

devout prawn
#

They ask me to create products and stuff to test on that
No, you only need to:

  1. Create a test clock
  2. Create a customer with that test clock
  3. Create a subscription with that customer
#

I want to somehow test subscriptions and the webhook that I have already created. In the test clocks, it seems that it does not redirect back to my app, it is just an independent testing environment, from what I understand anyway.
Once a subscription has a test clock, you can advance the clock and your webhook events will fire normally.

neat dagger
#

But if that subscription is created through the test clock, would it go through a checkout session completed event? I want to check if some stuff in my firebase firestore is getting populated

devout prawn
#

So you are using Checkout Sessions to create the subscription? Just make sure you pass a customer ID that has a test clock attached when you create the Checkout Session, and everything should work as expected.

neat dagger
#

oh, okei, I will try that. Thank you.

neat dagger
#

Ok, so, I have tested and it works with the clocks, I can simulate those payments. The problem is, the first time I do the checkout, it goes into the webhook, but the second payment (for the next month), it does not go into the webhook at all. And I mean, I have a console log before checking any event types, and that does not trigger. Shouldnt stripe send something through the webhook when that second payment was finished? @devout prawn Thanks.

devout prawn
#

Can you share the subscription ID (sub_xxx)?

neat dagger
#

sub_1Kyuj5DZVFyI1cD1okuwSpg2

#

the payments are in stripe, but the webhook only got called for the first payment, not for the later ones

devout prawn
#

so I see multiple invoice.paid

neat dagger
#

Yep, I understand that, you have a fair point. The only thing that seems odd is the following.

#

I understand it only entered the checkout

#

like here

#

but this is how I have got the webhook

#

there is a console log before the switch with events

#

shouldnt that console log execute everytime, independent of the event type?

devout prawn
#

shouldnt that console log execute everytime, independent of the event type?
yes, but you configured your webhook endpoint to only receive 4 events:

neat dagger
#

ahhhh

#

I got it now

devout prawn
#

so Stripe will only send these 4 events and nothing else.

neat dagger
#

Okei then, I understand now.