#torec
1 messages ยท Page 1 of 1 (latest)
Hi! Let me help you with this.
Thank you
It depends what other purchase methods you use. invoice.payment_succeeded only works with Invoices.
payment_intent.succeeded is more general: https://stripe.com/docs/api/events/types#event_types-payment_intent.succeeded
the other ways are that I'm doing a manual purchases (it's like free internal transaction, but I still use stripe as a record to keep the system consistent)
I may use Stripe Checkout from here and out, but I used to do everything my self, the collecting and processing. using Stripe Checkout for the first time. so I have "an old" webhook that is for "payment_intent.succeeded" event, it's also where I use it to generate the subscription roles and order.
and when I watched the logs I saw that invoice.payment_succeeded is called before the async
also in "invoice.payment_succeeded" I get all the information I need. (I know I can use expand).
just trying to find a common place to do all the transaction together
is called before the async
Please, don't rely on the event order. If they happen in a narrow timeframe, some events might arrive with a delay. Stripe does not guarantee the order.
In your case, I would say, use payment_intent.succeeded and try to get more information about where the sale came from by using PaymentIntent ID pi_xxx. This way you can get the Invoice or the Checkout Session.
OK. thank you. I'll investigate it
Happy to help. Please, let me know if you have any other questions.
what kind of expand should I do to get that information? on
$stripe->paymentIntents->retrieve(XXXX)
๐ taking over for my colleague. Let me catch up.
would you mind sharing an event ID you're listening to?
Hi, I just talking generally.
the summary is. we have a system that use a ways of transactions.
some are internal but uses Stripe for consistency, we may or may not using Stripe Element (like we use before) but now we had a complex card and I'm using Stripe checkout session, so I'm trying to find a common place to see if a payment was successful.
I have an existing webhook, that uses invoice.payment_succeeded.
I asked if I can use it for checkout session, vanya adviced to you payment_intent.succeeded.
and grab the PaymentIntent
the question is can I get the list_items out of it
is that event means that also the the payment is "Paid"? for sync and async purchases.
your question is so vague
my answer will depend on which mode of checkout sessions you have ("payment", "subscription")
there are a lot of factors to take into account
sorry.. ๐
in that particular situation we have a mix.
2 one time payments and 2 subscriptions
that why I wonder why "invoice.payment_succeeded" is not enough
in that case it's invoice.paid that you need to listen to
not invoice.payment_succeeded
it's a tricky thing to do but I will try to give you all the steps needed
for subscriptions you need to listen to invoice.paid as suggested here https://stripe.com/docs/billing/subscriptions/webhooks#events
this will cover both subscriptions with initial payment and trial or 0 amount first invoices
OK nice
I just did a compare on the JSON from both events
they are indentical, so easy adaptation
for the payments you can listen to payment_intent.succeeded and if invoice field is not null you can discard this event and not handle it
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
When an invoice is not created? if there is a payment only?
sorry for asking maybe too many questions ๐
you want the line_items?
no
when you listen to payment_intent.succeeded
you can list the checkout sessions with that payment intent https://stripe.com/docs/api/checkout/sessions/list#list_checkout_sessions-payment_intent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
then you can retrieve the line_items of that checkout session https://stripe.com/docs/api/checkout/sessions/line_items
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.