0.9.1 • Published 1 year ago

@smartpay/sdk-node v0.9.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Smartpay Nodejs SDK

The Smartpay Nodejs SDK offers easy access to Smartpay API from applications written in Nodejs.

Prerequisites

Nodejs v12+

Installation

npm install --save @smartpay/sdk-node
# or
yarn add @smartpay/sdk-node

Usage

The package needs to be configured with your own API keys, you can find them on your dashboard.

const Smartpay = require('@smartpay/sdk-node').default;

const smartpay = new Smartpay('<YOUR_SECRET_KEY>', {
  publicKey: '<YOUR_PUBLIC_KEY>',
});

If you would like to know how Smartpay payment works, please see the payment flow for more details.

Create Checkout session

(async () => {
  const payload = {
    items: [
      {
        name: 'レブロン 18 LOW',
        amount: 250,
        currency: 'JPY',
        quantity: 1,
      },
    ],

    shipping: {
      line1: 'line1',
      locality: 'locality',
      postalCode: '123',
      country: 'JP',
    },

    // Your internal reference of the order
    reference: 'order_ref_1234567',

    // Callback URLs
    successUrl: 'https://docs.smartpay.co/example-pages/checkout-successful',
    cancelUrl: 'https://docs.smartpay.co/example-pages/checkout-canceled',

    test: true,
  };

  const session = await smartpay.createCheckoutSession(payload);
})();

The shape of checkout session payload is described in the docuement.

To retreive the session URL

const sessionURL = smartpay.getSessionURL(session);

We also prepare a more real-world example for you to refer to.

Reference

Please check the reference document.

0.9.1

1 year ago

0.9.0

1 year ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.5.1

2 years ago

0.3.0

2 years ago

0.2.1

2 years ago

0.3.2

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.2.0

2 years ago

0.1.8

2 years ago

0.1.7

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago