FLUX-SE / PayumStripe

Payum Stripe gateways (with SCA support)
MIT License
28 stars 15 forks source link

Cancel payment not possible since Stripe version 2022-08-01 #38

Closed dragosprotung closed 9 months ago

dragosprotung commented 9 months ago

Since Stripe version 2022-08-01 cancelling a payment ($gateway->execute(new Cancel($cancelToken))) is no longer working.

See https://stripe.com/docs/upgrades#2022-08-01 for changelog. The change affecting the cancel action:

A PaymentIntent is no longer created during Checkout Session creation in payment mode. Instead, a PaymentIntent will be created when the Session is confirmed.

\FluxSE\PayumStripe\Action\StripeCheckoutSession\CancelAction and \FluxSE\PayumStripe\Action\CancelAction check for the capture_method and rely on the PaymentIntent that is never created.

Prometee commented 9 months ago

Thank you very much @dragosprotung, I was expecting Stripe standardize this part one day because the subscription and setup intent are acting the same way. Are you able to start a PR about it ? If not I will create it as soon as possible.

Prometee commented 9 months ago

The way to handle it can be to check for the object name contains in the $model['object'] and directly expire the session if the object found is a checkout session. To keep backward compatibility we can :

Prometee commented 9 months ago

@dragosprotung are you able to review the PR or test it ?

dragosprotung commented 9 months ago

@Prometee you were fast :) I tested the PR in my environment and it looks good. :+1:

Prometee commented 9 months ago

I was an easy one this time :D