Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@smartpay/sdk-node

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smartpay/sdk-node

Smartpay SDK NodeJS

  • 0.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-60%
Maintainers
3
Weekly downloads
 
Created
Source

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);
})();

We supports two formats of the checkout session payload. The first one is strict format. You will have the full control to the session payload if you choose to use strict format. Please checkout the API document for more information about the strict format.

The second supported format is loose format. This format is a less complexity version of the strict format. Our SDK will transform the payload to strict format before sending to our API endpoint.

To retreive the session URL

const sessionURL = smartpay.getSessionURL(session);

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

Keywords

FAQs

Package last updated on 11 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc