FLUX-SE / PayumStripe

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

Find a better way to handle 'cancel_url' #3

Closed Prometee closed 3 years ago

Prometee commented 4 years ago

Cancel url means the customer wants to :

As I write these words the behaviour of the cancel_url is the one describe bellow. Technically it is done by this line of code In fact this status normally corresponds to a payment in the "new" state, but since this line of code is reached only during the second capture call, it then corresponds to the return of the client using the URL cancel_url (Only if $token->getAfterUrl() is a capture url).

A better solution could be to add something to the cancel_url and detect it, to change the PaymentIntent to the more appropriate status : canceled (PaymentIntent::STATUS_CANCELED). But I'm not really fan of this technique as the URL of the host could be restricted to the base Payum URL pattern like: /capture.php?token_hash= or an other restriction could be in place to disallow adding something to the capture URL. Payum has also the possibility to call a dedicated cancel url but this URL is not available in all Payum projects (ex: Sylius never activate this route payum_cancel_do). So right now I did not found better solution to handle it...