1

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...

coatesap
  • 10,707
  • 5
  • 25
  • 33

1 Answers1

0

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.

Adrian Macneil
  • 13,017
  • 5
  • 57
  • 70
  • I can see why this is a bit tricky, and as you say, maybe a default/required fields array may be the way to determine this within OmniPay in the future. We're probably in the minority in having a multi-gateway setup, but obviously that's the appeal in using a library that tries to abstract away the differences. – coatesap Jan 02 '14 at 17:06
  • Do you think that storing the method used to collect card details in our gateways database table might be the best method for the time being? – coatesap Jan 02 '14 at 17:10
  • Yes, for each transaction I would definitely store which payment method was used, along with the reference returned from the gateway. – Adrian Macneil Jan 02 '14 at 23:29