#Marco by Endesa Srl
1 messages · Page 1 of 1 (latest)
hello! since https://stripe.com/docs/upgrades#2022-08-01
A PaymentIntent is no longer created during Checkout Session creation in payment mode. Instead, a PaymentIntent will be created when the Session is confirmed.
can you share more on what you're trying to do/achieve here?
Hi Alex-stripe,
thanks for your answer.
I've an ecommerce with checkout and payment with Stripe.
If I execute a:
$stripe->checkout->sessions->all(['limit' => 1])
?
i'm sorry but i don't understand. What are you trying to achieve i.e. why do you need the PaymentIntent?
Without ID I can't intercept the payment outcome wekbhook
you'd generally use thecheckout.session.completedwebhook event, not thepayment_intent.*ones.
When I get the webhook event (payment_intent.payment_failed or payment_intent.succeeded), how do I figure out which payment it refers to?
Previously in sessions->create I was storing on DB the payment_intent and it was the same as the one I received on the webhook and I could cross-reference request and response
yep this is a change in newer API versions really.
The way you're supposed to do this is listen to checkout.session.completed and then you can access the session->payment_intent at that point and do whatever you need to do with that
https://stripe.com/docs/api/checkout/sessions/create
In doc there is 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.
those are the parameters for creating a CheckoutSession
not the fields on the CheckoutSession.
Thanks karllekko.
This is part of code of webhook:
`{
"id": "evt_3M9uiAEokIae2bxm08oSjT5Z",
"object": "event",
"api_version": "2022-11-15",
"created": 1669831729,
"data": {
"object": {
"id": "pi_3M9uiAEokIae2bxm03qPsomG",
"object": "payment_intent",
"amount": 5000,
"amount_capturable": 0,
"amount_details": {
"tip": {
}
},
"amount_received": 5000,
}On webhook have an ID. When I call$stripe->checkout->sessions->createhow do I retrieve the ID? Do I have to trigger a new webhook eventcheckout.sessions.completed` and retrieve it from there?
Am I understanding this correctly?
Previously I used the ->data->object->id