- Issue created by @nicolas bouteille
In StripePaymentElement->processWebhook, for a payment_intent.succeeded we currently call $this->createPayment
In our case, we already have a PaymentIntent and we know that it is succeeded.
The code inside StripePaymentElement->createPayment does many thing.
It tries to retrieve the PaymentIntent id from the order data
$intent_id = $order->getData('stripe_intent');
It also retrieves again the PaymentIntent remotely from Stripe whereas we already have it.
If for some reason stripe_intent was not found in the order's data, the risk is that a new PaymentIntent is created and $intent->confirm() is called, thus processing a new payment request to Stripe for that customer which would be very bad.
In our case, because we already have the PaymentIntent object and it is succeeded, it seems that only the last piece of code of createPayment is needed and I say we'd better duplicate the part we need instead of relying on createPayment and risk executing the rest of the code by mistake.
What do you think?
Active
1.2
Payment Element