HiPay Professional SDK for NodeJS. You can create orders (payment pages), capture or refund payments and securely decode Notifications (callbacks / pingbacks) sent by HiPay.
This module provides its own TypeScript declarations (.d.ts).
npm install hipay-professional-sdk
const {HipayClient} = require('hipay-professional-sdk');
const hipayClient = new HipayClient({
env: 'production',
login: 'YOUR_API_LOGIN',
password: 'YOUR_API_PASSWORD',
});
hipayClient
.createOrder({
websiteId: YOUR_WEBSITE_ID,
categoryId: YOUR_PRODUCT_CATEGORY,
currency: 'EUR',
amount: '4.99',
rating: 'ALL',
locale: 'fr_FR',
customerIpAddress: CUSTOMER_IP,
description: 'Life subscription to a super service!',
executionDate: new Date(),
manualCapture: true,
urlCallback: 'https://domain.tld/hipay-callback',
})
.then((response) => {
if (response.error) {
// HiPay reported an error during the request
console.log(response.error); // {code: number, description: string}
return;
}
// HiPay created the new order, you can redirect your customer to the
// payment page!
console.log(response.result); // {redirectUrl: string}
})
.catch((err) => {
// An exception has occurred during the request (network error, ...)
});
To begin you need to get your API credentials :
You must also create a website and get it's ID:
You can now start using this SDK! Usual flow is:
For a detailed API reference, see: hipay-professional-sdk-js.nathan818.fr
This project uses TypeScript. To create javascript sources run:
yarn run build
For unit tests, a real payment flow is reproduced and tested (on the HiPay staging API):
Run the unit tests, install the dependencies and run yarn test
:
yarn install
yarn run test
Contributions are welcome. It is recommended to open an issue before introducing new features to discuss them.
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the Apache-2.0 License. See the LICENSE file for details.
Generated using TypeDoc