I have created an offsite (redirect form) payment gateway Drupal 8 module for Opayo.co.uk. following drupal commerce documentation.
Issue: My custom off-site payment gateway module based on form redirect works perfectly fine on fresh Drupal 8 Commerce site with default checkout-flow.
response from payment provider is received on these ends:
/checkout/ORDER-ID/payment/return
(on successful payment)
/checkout/ORDER-ID/payment/cancel
(on failure)
-> But on an exisiting D8 commerce booking system (with overridden checkout-flow using a custom module) when user returns from payment providor with a response string there occurs a redirect loop between booking system and payment providers payment form.
The response from provider does not reach my module's plugin where onReturn() and onCancel() functions will process the response.
Redirect loop occurs on path /checkout/ORDER-ID/payment/
where user clicks finally "Pay and Complete Purchase" button and data is handled by "Payment process" pane.
-> I can find that a custom checkout module creates event subscriber which acts on every page load checks checkout url parameters.
Any help is highly appreciated, and thanks for reading this.