global-payments-hpp-ts
v1.0.1
Published
Global Payments HPP (Hosted Payment Page) SDK for RealexHpp integration
Maintainers
Readme
global-payments-hpp-ts
TypeScript SDK for Global Payments HPP (Hosted Payment Page) / RealexHpp integration.
Installation
npm install global-payments-hpp-tsUsage
import { RealexHpp } from "global-payments-hpp-ts";
// JSON response from your backend endpoint
const exampleJsonResponse = {
MERCHANT_ID: "YOUR_MERCHANT_ID",
ORDER_ID: "ORDER_123456",
TIMESTAMP: "20231215120000",
AUTH_CODE: "AUTH123",
RESULT: "00",
// GP can ask other fields
};
const getJsonFromYourEndpoint = (): Promise<typeof exampleJsonResponse> =>
Promise.resolve(exampleJsonResponse);
const processPaymentForGP = () =>
getJsonFromYourEndpoint().then((json) => {
console.log(json);
RealexHpp.setHppUrl("https://pay.sandbox.realexpayments.com/pay");
RealexHpp.lightbox.init("autoload", "", json);
});API
RealexHpp
setHppUrl(url: string)- Set HPP URL (sandbox or production)lightbox.init(mode, callback, json)- Initialize lightbox payment form
URLs
- Sandbox:
https://pay.sandbox.realexpayments.com/pay - Production:
https://pay.realexpayments.com/pay
License
MIT
