npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hipay-professional-sdk

v1.2.0

Published

HiPay Professional SDK for JavaScript

Downloads

16

Readme

hipay-professional-sdk

npm version TypeScript Build Status codecov

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).

Installation

npm install hipay-professional-sdk

Example

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, ...)
    });

Usage

To begin you need to get your API credentials :

  • Login to the Hipay Professional dashboard
  • Go to the Toolbox
  • Your API credentials will be under "Access to the web service" (and are named "Login" and "Password")

You must also create a website and get it's ID:

  • On the dashboard, go to Products > Website
  • Click on "Register a new Website", complete the form and validate
  • Get your website ID (will be under your website name)

You can now start using this SDK! Usual flow is:

  1. Create an order (HipayClient.createOrder)
  2. Redirect your customer to the payment page
  3. Listen for Notifications (callbacks / pingbacks) calls (HipayClient.parseNotification)
  4. Capture payments (HipayClient.captureOrder)

Documentation

For a detailed API reference, see: hipay-professional-sdk-js.nathan818.fr

Building

This project uses TypeScript. To create javascript sources run:

yarn run build

Testing

For unit tests, a real payment flow is reproduced and tested (on the HiPay staging API):

  • An order is created
  • A browser is opened on the payment page and make a payment
  • A Notification (callback) listener wait for the transaction autorisation
  • The order is captured
  • A Notification (callback) listener wait for the transaction capture (and several other complementary tests are performed)

Run the unit tests, install the dependencies and run yarn test:

yarn install
yarn run test

Contributing

Contributions are welcome. It is recommended to open an issue before introducing new features to discuss them.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the Apache-2.0 License. See the LICENSE file for details.