Skip to content

Headless setup in Shopware 6

Reinder edited this page Aug 13, 2020 · 6 revisions

Intro

For working in a headless setup, we implemented two events in the Mollie Payments plugin that will make this possible. You can hook into these events with your shop, to handle the redirection of the customer once the customer has passed the payment page of Mollie.

Event for successful payments

If a payment was successful, the PaymentPageRedirectEvent (see the file PaymentPageRedirectEvent.php in src/Events) is triggered. The event returns the order object of the order in Shopware, the object of the order in Mollie, the ID of the sales channel and the redirectURL where the customer is supposed to be redirected to. This will be the URL of the finish page in the checkout. You can use this data to guide your customer to the right location.

Event for failed payments

If a payment fails, the PaymentPageFailEvent (see the file PaymentPageFailEvent.php in src/Events) is triggered. The event also returns the order object of the order in Shopware, the object of the order in Mollie, the ID of the sales channel and the redirectURL where the customer is supposed to be redirected to. This time, the redirect URL will lead to a payment page of Mollie where the customer can pay with a different payment method. You can use this data to show the customer that something went wrong and guide the customer to the URL where they can finish the payment with a different method.

Clone this wiki locally