#Chicken Tender Appreciator - Subscription Webhooks

1 messages · Page 1 of 1 (latest)

near coral
#

Hello!

sage grove
#

Hi! Thanks for the quick response!

#

Please let me know if there is anything I can elaborate on to help you understand my issue

near coral
#

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.

sage grove
#

ok, a few questions:

  1. I currently use checkout sessions. Does this mean that if I were to continue to use invoice.payment_suceeded that it would no longer work in the case that I moved it to stripe elements within my own site?
  2. Do you think that I could just use the customer.subscription.updated for 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.
  3. 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
near coral
#
  1. I currently use checkout sessions. Does this mean that if I were to continue to use invoice.payment_suceeded that 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.

  1. Do you think that I could just use the customer.subscription.updated for 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.

  1. 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.

sage grove
#

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

near coral
#

What specifically do you want to test? I explained how to test the current_period_end changes above.

sage grove
#

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

near coral
#

There are a few options:

  1. To test exactly that you can create a Subscription that lasts a day, then wait a day
  2. You can create a Subscription and then change the billing_cycle_anchor to trigger an Invoice: https://stripe.com/docs/billing/subscriptions/billing-cycle#changing
  3. 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

sage grove
#

and I can't feel confident trusting it, because it didn't come from Stripe

#

thanks for the links!

near coral
#

Yeah, that blog post is very out of date.

sage grove
#

I think you've helped me all you can, I really appreciate it!