FLUX-SE / PayumStripe

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

Payment Intent Webhook Issue #25

Closed Kovaloff closed 2 years ago

Kovaloff commented 2 years ago

Hi, I'm using your bundle (stripe checkout ) in the Symfony app and everything works fine except for one issue with the webhook events -

All events except 'checkout.session.completed' do not work

Request WebhookEvent{model: EventWrapper} is not supported. Make sure the gateway supports the requests and there is an action which supports this request (The method returns true). There may be a bug, so look for a related issue on the issue tracker. (500 Internal Server Error)

Maybe you have some suggestions? Thanks

Prometee commented 2 years ago

Hi @Kovaloff,

Kovaloff commented 2 years ago
  1. yes, able to reproduce with a local listener
  2. Yes
  3. flux-se/payum-stripe-bundle": "^2.0"
Prometee commented 2 years ago

It can be two things :

  1. The notify url is the wrong one
  2. There is something hapening during the webhook event consummation

For the first point check using your terminal that the url is well formatted :

./bin/console debug:router payum_notify_do_unsafe

# should be like this for example :
# +--------------+-------------------------------------------------------------------------------------+
# | Property     | Value                                                                               |
# +--------------+-------------------------------------------------------------------------------------+
# | Route Name   | payum_notify_do_unsafe                                                              |
# | Path         | /payment/notify/unsafe/{gateway}                                                    |
# | Path Regex   | {^/payment/notify/unsafe/(?P<gateway>[^/]++)$}sD                                    |
# ....

# Resulting url could be : https://mydomain.tld/payment/notify/unsafe/stripe_checkout_session
# if your gateway name is "stripe_checkout_session"

If it's the second point here is how a webhook is handle and you can then xDebug it step by step to discover what's goes wrong :

  1. Payum will receive a Notify wich is supported by this action : NotifyAction
  2. It will then execute a ResolveWebhookEvent suported by this action : ResolveWebhookEventAction
  3. The ResolveWebhookEventAction is in charge of checking the webhook signature and to create a wrapper class containing the webhook data and the webhook key validating it (EventWrapper interface).
  4. Finally it get back to the NotifyAction to consume the webhook event by any class supporting it (list of all action consuming webhook events and this files only used for stripe_checkout_session factory)

Your issue could be in one of those files CheckoutSessionAsyncPaymentSucceededAction extending the AbstractPaymentAction.

Prometee commented 2 years ago

Hello @Kovaloff

I think I found the issue you had, if you are using the mode "authorize" then the WebhookEvent Action handling the events : payment_intent.canceled and payment_intent.succeeded were not handle properly.

This is now fix and I'm about to make a new release.

Kovaloff commented 2 years ago

Hi @Prometee

Great news, so its already released ?

Prometee commented 2 years ago

@Kovaloff yes it is 😉

Kovaloff commented 2 years ago

@Prometee do you know what is the delay on packagist after new release? updated the package in my project, but cannot find your changes

Prometee commented 2 years ago

It depends on the cache you have but normally it take minutes to be available.

Kovaloff commented 2 years ago

@Prometee thanks, everything works fine