Closed cruonline closed 2 years ago
Actually, this is working properly, you need the /payment/finalize-transaction
endpoint to be available as it will eventually emit a 301 redirect back to your client, after updating the payment state. We are trying to figure out another day of doing this, but for the moment, it is the only way to inform Shopware about the payment status. Stripe should not redirect straight to your PWA, as Shopware wouldn't be able to know about anything that happened in the meantime.
@elkmod I'm petty sure, webhooks are for this purpose and they are triggered async and headless in most cases. Webhooks are in fact most important way of communication between payment gates, as allow delayed approval, chargeback and other scenarios without user interaction. (eg. browser dies, user closes browser or navigates away)
Redirect is meant for end user consistent flow, and it is not needed for shopware to handle payment. Yes I know it contains payment details (if completed) but it is supplementary (and we can also decode it on PWA if we choose to)
As for the /payment/finalize-transaction endpoint, it redirects user to login screen, so there goes redirection to PWA... :(
If I am talking nonsense, I am sorry. But I have tested it, by blocking redirection in browser and payment was registered in shopware. Unless I messed up something :)
any further comments, feedback? If I'm wrong, ELI5
Anyone willing to help me? Bug or not aside, how to prevent user being stopped at login page after payment callback.
hi @cruonline, in the upcoming release we've got it done like it's here: https://github.com/vuestorefront/shopware-pwa/blob/master/packages/default-theme/src/pages/checkout.vue#L190
getAbsoluteUrl
method that generates the whole PWA URL like "http://localhost:3000/en-US/success".Under the hood, the handle-payment endpoint saves these URL to know what's the URL the customer has to be redirected in success/fail scenarios (special token is generated to identify the config). After the payment is done, the payment provider redirects the customer to finalize-transaction of API and then to the one of provided URLS (finishUrl or errorUrl in handle-payment method)
I recommend you to follow this flow and see what will happen 👍🏻 let us know if it's working :)
thanks @mkucmus , I will give it a try. Keep up the good work!
@cruonline did it work? ;)
@mkucmus I was decided (not by me) to skip PWA fronted for now, and focus on delivering "classic" SW6 experience first :( I will get back to it, just not now. If not for the current project, for sure next one, as I love the idea of SPA/PWA shop experience.
Ok then :) We've been using paypal & adyen payment plugins and no such error occured. So I'm closing the issue.
Describe the bug
After making a payment with STRIPE user is redirected to "http://shop.backend.url/payment/finalize-transaction instead of http://shop.frontent.url/order/###
The call to /pay endpoint contains the proper URL, however, stripe receives a payment object with the wrong redirect URL. In a result, user lands on "classic" storefront channel, not PWA Disabling this channel leads to 500 error on both redirect and webhook calls.
This may be problem with stripe plugin, not shopware-pwa, but any help will be greatly appreciated :)
Additional context
Shopware 6.3.5.4 phopware-pwa 0.8.1 PWA Integration (v0.2.1)