academe / SagePay-Integration

HTTP Messages for the Sage Pay REST (Pi) gateway.
GNU General Public License v3.0
9 stars 5 forks source link

Workaround for card surcharges #55

Open judgej opened 7 years ago

judgej commented 7 years ago

The front end card tokenisation does not supply the card type. If the application is to add surcharges to specific cards, then it needs to know the card type before sending the payment request.

The card type will be supported in this gateway card tokenisation response soon, but until then, something like http://jquerycreditcardvalidator.com/ can provide a workaround by determining the card type on the front end and including it in the submitted form. This is unlikely to work for the iframe CC form, but would work for a custom CC form.

This ticket is just somewhere to log any examples of how this can be done.

judgej commented 7 years ago

Looking again at the docs, it seems that the card type is supplied in the API when a card identifier is created. This is an example response:

{
  "cardIdentifier" : "C6F92981-8C2D-457A-AA1E-16EBCD6D3AC6",
  "expiry" : "2015-06-16T10:46:23.693+01:00",
  "cardType" : "Visa"
}

It is just that the default JS onTokenise handler does not put the card type into the form to be submitted. Maybe just a custom handler is what is needed?

judgej commented 2 years ago

I think this is a non-issue now?