Solved

Which Stripe events do I listen to in order to post receipts

  • 2 December 2021
  • 2 replies
  • 409 views

Badge +3
  • Dedicated Member
  • 22 replies

I followed this guide to send events directly from Stripe to RevenueCat. 

 

I also saw this link for sending our tokens to RevenueCat which must be done before the above events (I think). I send the token during “checkout.session.completed” but it doesn’t look like that event is happening. Should we be posting receipts from “invoice.payment_succeeded” ? Might be good to put something about this in your docs.

 

icon

Best answer by cody 7 December 2021, 22:00

View original

2 replies

Userlevel 6
Badge +8

Hey @Tony!

If you’re using Stripe Checkout or Stripe Payment Links, the token should be sent from the `checkout.session.completed` webhook. This event is called once the the checkout session is completed with a purchase. You can see this in action in our sample project here: https://github.com/RevenueCat-Samples/stripe-no-website-example

If you’re not using Stripe Checkout, it might be a different webhook event that is called after a successful payment (like you mentioned, possible the invoice.payment_succeeded webhook). Basically, we need the Stripe Subscription ID (`sub_**`) as well as the app user ID it should be connected to.

I’ll add this to our backlog to clarify in our docs- let me know if that helps!

Badge

I need my own server for this? I was using revenue cat to avoid that in the first place. Why doesn’t revenue cat handle the “checkout.session.completed” webhook its self? The stripe checkout https://stripe.com/docs/js/checkout/redirect_to_checkout allows you to specify a clientReferenceId (userId) so revenuecat would know how to relate the data.

When I try to add this event to the webhook revenuecat gives me a error stating Invalid Stripe webhook event type (checkout.session.completed).

Reply