Question

When using Omnipay on a multi-gateway site, is there a way to check whether the current/selected gateway needs to collect the card details on-site, or alternatively, whether we should redirect the user to an off-site location?

Eg. When using Paypal Pro, we obviously want to present the user with the credit card form so that they fill in their details on-site. When using Paypal Express, we need to redirect them straight away, and not ask for card details...

Was it helpful?

Solution

Short answer: No

Long answer: It's a bit more complicated than that. Not all gateways are 100% either off-site or on-site. For example Sage Pay Direct takes credit card details on your site, but then some cards will require redirection to a third party site because they require 3d-secure.

For this reason, the redirect is part of the Response, not inherent in the gateway. You can use $response->isRedirect() to detect whether you need to redirect to an off-site URL for further processing.

Regarding credit card fields - it's not possible to know in advance which fields are required by the gateway either, this often depends on which features are enabled on your particular account, or the card in question. It may be possible to add some sort of "default display fields" to Omnipay, but it doesn't exist yet.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top