3

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.

Mani5556
  • 394
  • 2
  • 12
  • 33
  • 2
    It looks like you need to do a request from your server first, which will return data you will then include in your JS. See https://github.com/realexpayments/rxp-hpp-php#creating-request-json-for-realex-js-sdk for an example using the PHP server SDK. – jcaron May 04 '17 at 21:17
  • Unfortunately my server-side is .NET, so this isn't the best news, but I kind of suspected this. Thanks. – Mani5556 May 05 '17 at 14:43
  • 1
    Over 90% of the code of the PHP SDK is boilerplate, logging, exception handling, getters and setters. The actual "useful" code is really just a few functions. Porting it to .NET or any other environment should be trivial, especially given the fact that the PHP code seems to be very very clean. – jcaron May 05 '17 at 23:02

0 Answers0