#Chicken Tender Appreciator - Subscription Webhooks
1 messages · Page 1 of 1 (latest)
Hi! Thanks for the quick response!
Please let me know if there is anything I can elaborate on to help you understand my issue
A few things... first, we recommend listening for invoice.paid over invoice.payment_succeeded as the former will fire every time an Invoice is paid (including out of band), but the latter will only fire if the Invoice is paid with Stripe.
For updating the Subscription's current_period_end value on your end I recommend listening for customer.subscription.updated so you get the actual Subscription in the event and can update using the actual value when it changes.
That will also handle more possible future scenarios, like the billing cycle changing.
For testing this I recommend you sign up for the Billing Clocks beta: https://stripe.com/docs/billing/testing/billing_clocks
In the meantime you can test the scenarios you're talking about by adjusting the billing cycle anchor on the Subscription to trigger changes to the current_period_end on demand: https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_cycle_anchor
ok, a few questions:
- I currently use checkout sessions. Does this mean that if I were to continue to use
invoice.payment_suceededthat it would no longer work in the case that I moved it to stripe elements within my own site? - Do you think that I could just use the
customer.subscription.updatedfor both the case where I am getting my first payment and when I receive subsequent monthly payments? What other things could happen which might trigger this event/my webhook to be called? I only care about these two. - I have signed up for billing clocks beta twice in the past two days and I haven't received an email about it, not sure what to do about it next. I will look into using it
- I currently use checkout sessions. Does this mean that if I were to continue to use
invoice.payment_suceededthat it would no longer work in the case that I moved it to stripe elements within my own site?
No, that event will still work. However, let's say you had an Invoice that was paid for with cash outside of Stripe. If you go into the Dashboard and mark that Invoice as paid the invoice.paid event will fire, but the invoice.payment_succeeded event will not.
- Do you think that I could just use the
customer.subscription.updatedfor both the case where I am getting my first payment and when I receive subsequent monthly payments? What other things could happen which might trigger this event/my webhook to be called? I only care about these two.
I don't believe customer.subscription.updated will fire when a Subscription's first payment is made. If the only thing you care about is when Subscription Invoices are paid you should listen for invoice.paid, but you also indicated an interest in when a Subscription's current_period_end changed too, which is why I recommended the other event too.
- I have signed up for billing clocks beta twice in the past two days and I haven't received an email about it, not sure what to do about it next. I will look into using it
The Billing Clocks beta is brand new and you likely won't hear anything for a while. I wanted you to get on the list so you're notified when it's available, but in the meantime you should assume it doesn't exist and test using other methods.
Thank you so much for the responses!
3. Regarding number 3 here--how do people normally go about testing these sorts of things? I'm really struggling to find a good way to do this which doesn't require less than 24 hour feedback loops
What specifically do you want to test? I explained how to test the current_period_end changes above.
I want to test the exact case of all the stripe-internal events that get called when the subscription is renewed a month after creation (and every subsequent month)
I found this on somebody's blog
There are a few options:
- To test exactly that you can create a Subscription that lasts a day, then wait a day
- You can create a Subscription and then change the
billing_cycle_anchorto trigger an Invoice: https://stripe.com/docs/billing/subscriptions/billing-cycle#changing - You can create a Subscription with a very short trial period which will trigger an Invoice for the first payment at the end of the trial
You may also be interested in our documentation on the Subscription lifecycle: https://stripe.com/docs/billing/subscriptions/overview#subscription-lifecycle
And our documentation on Subscription events: https://stripe.com/docs/billing/subscriptions/overview#subscription-events
and I can't feel confident trusting it, because it didn't come from Stripe
thanks for the links!
Yeah, that blog post is very out of date.
I think you've helped me all you can, I really appreciate it!