#StefanG-subscription
1 messages · Page 1 of 1 (latest)
Hello!
The shorter internal for a recurring price is 1 day: https://stripe.com/docs/api/prices/create#create_price-recurring
But if it's for testing, you could use test clocks https://stripe.com/docs/billing/testing/test-clocks
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?
They ask me to create products and stuff to test on that
No, you only need to:
- Create a test clock
- Create a customer with that test clock
- 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.
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
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.
oh, okei, I will try that. Thank you.
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.
Can you share the subscription ID (sub_xxx)?
sub_1Kyuj5DZVFyI1cD1okuwSpg2
the payments are in stripe, but the webhook only got called for the first payment, not for the later ones
you can see all events triggered for that subscription: https://dashboard.stripe.com/test/events?related_object=sub_1Kyuj5DZVFyI1cD1okuwSpg2
so I see multiple invoice.paid
however your webhook endpoint is only listening to checkout.* events, so it's expect that you don't receive any events https://dashboard.stripe.com/test/webhooks/we_1K3JdYDZVFyI1cD1nu5PGJS0
you need to update your webhook endpoint to listen to more events related to subscriptions. you can learn more about this here: https://stripe.com/docs/billing/subscriptions/webhooks#events
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?
shouldnt that console log execute everytime, independent of the event type?
yes, but you configured your webhook endpoint to only receive 4 events:
so Stripe will only send these 4 events and nothing else.
Okei then, I understand now.