#Peppa
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
Hi Tarzan ๐
I already had subscriptions implemented, but now we're trying to offer a "lifetime" package in the form of a one-time purchase.
Sadly, I can't seem to distinguish which product the user purchased
you shouldn't be listening to charge.succeeded but instead listen to checkout.session.completed and based on that event you can look at the mode to see whether it's payment = one time payment or subscription which is a subscription
another thing that you can do
is to listen to invoice.paid and payment_intent.succeeded
and whenever you get a payment_intent.succeeded event if the invoice property isn't null you ignore the event
and in the invoice.paid you can get the subscription property and then retrieve the corresponding subscription
Yeah sweet, I am using invoice.paid to process subscriptions indeed
is there a way to find out which product they purchased from the Checkout.Session.Completed event?
๐ stepping in
When you receive that Event you want to retrieve the Checkout Session and expand line_items to get the Product info.
Are you familiar with expansion?
If not, see: https://stripe.com/docs/expand
Okay so take a look at that doc