You can sign up for a Realex account at https://developer.realexpayments.com
The Javascript required to initialise the library is below. This code must only be executed when the DOM is fully loaded. (default method: lightbox)
RealexHpp.init(payButtonId, merchantUrl, jsonFromServerSdk[, options]);
The following code enables a logger that will emit an event on each step performed by the library. Should be used for debugging only.
RealexHpp.setConfigItem('enableLogging', true);
window.addEventListener(RealexHpp.constants.logEventName, function(e) {
console.log(e.detail);
});
Once the payment has completed the Realex JSON response will be posted within to the supplied merchantUrl. The name of the field containing the JSON response is hppResponse.
If you prefer to handle response manually, provide your own callback function in "merchantUrl". The answer will be pre-parsed to an object ready to be used.
RealexRemote.validateCardNumber(cardNumber);
RealexRemote.validateCardHolderName(cardHolderName);
RealexRemote.validateCvn(cvn);
RealexRemote.validateAmexCvn(amexCvn);
RealexRemote.validateExpiryDateFormat(expiryDate);
RealexRemote.validateExpiryDateNotInPast(expiryDate);
See the LICENSE file.