I'm trying to figure out the usage of the Realexpayments javascript sdk, found here: https://github.com/realexpayments/rxp-js (and using the hosted pay page solution).
The usage makes a lot of sense, I have a rxp-hpp.js file that I can use like this:
RealexHpp.init(payButtonId, merchantUrl, jsonFromServerSdk);
The part that I don't understand is
payButtonId - The ID of the button used to launch the lightbox. merchantUrl - The URL to which the JSON response from Realex will be posted. jsonFromServerSdk - The JSON output from the Realex HPP Server SDK.
the jsonFromServerSdk - how do I get\build that? I could see if it was json I'd need to build up on the client side, but jsonFromServerSdk would imply that I need to get that somehow (beforehand), and it isn't explained too well on the readme file.
I think I'm just missing something vital here. The idea is to have a payment handled purely on the realex site (and not my website) as to be PCI compliant (i.e. no credit card #'s on my site at all).
Any assistance\explanation would be appreciated, thanks.
I should be able to get away wtih avoiding a server-side call just for testing, but I'm trying this:
var myJson= JSON.stringify({
TIMESTAMP: '20170504081338',
'MERCHANT_ID': '<mymerchantid>',
ACCOUNT: 'internet',
ORDER_ID: 'testorderid',
AMOUNT: '11.95',
CURRENCY: 'CAD',
SHA1HASH: '<myhash>',
CUST_NUM: 'testcustnum',
HPP_LANG: 'US',
HPP_VERSION: '2',
CARD_PAYMENT_BUTTON: 'Pay.'
});
RealexHpp.init(payButtonId, myMerchantUrl, myJson);
And it seems to be trying to work: but I get a red error that says: Invalid MERCHANT_ID or ACCOUNT. Please contact the merchant.
Hard to tell if maybe my json is malformed, or what.