1.1.0 • Published 11 months ago

@storeshippers/checkout v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

StoreShippers Checkout

StoreShippers has a shipping API that connects you with 100+ local and global carriers. This is a client library for accessing the Checkout SLA API from StoreShippers. It provides a standard interface for comunicating with the StoreShippers platform.

Get Started Quickly

The best way to get started quickly is by using out staging environment. In order to step in production, the base url and nonce token have to be changed to production values. The rest of the flow remain the same.

Follow the steps below to start:

  1. Run npm install @storeshippers/checkout in your terminal
  2. Require it in a component of your choice with const storeShippers = require("@storeshippers/checkout")(BASE_URL, NONCE, TOKEN)
  3. Run this line before the loop that populates your shipping options: sts.checkoutSlaCheck(shipment_info)
  4. To create an order, forward the selected id from the previous list and run: sts.checkoutOrderCreate("da7553ee-cd18-493d-9833-f9afa872c4ae")

Staging Credentials

NameTypeDefaultDescription
BASE_URLstrhttps://api-staging.storeshippers.com/The base URL where all requests are directed to.
NONCE_TOKENstreyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjg5NCwiZXhwIjoxNzQwNDc3NzkzfQ.pX_9C91EsYht60sMHmXd-9WctV2SibOzgqbMXg2pLeUThe Token required to use the checkout API.

Example usage

The example below is intended to illustrate

// Store your credentials and url (better in env)
const BASE_URL = 'https://api-staging.storeshippers.com/';
const NONCE = '<ENTER NONCE>';
const TOKEN = '<ENTER TOKEN>';

// import the package
const sts = require('./base')(BASE_URL, NONCE, TOKEN);

// Get possible delivery options
sts.Checkout.checkoutSlaCheck().then(response => {
    // handle response
})
// Get possible PUDO options, their carriers, delivery times and availability 
sts.Checkout.checkoutPudoCheck({}).then(response => {
    // handle response
})
// Forward the SLA id you received in the response.
sts.Checkout.checkoutOrderCreate({},"<sla_id>").then(response => {
    // handle response
})

License

The StoreShippers Checkout for Javascript is currently licensed under the MIT Licence.

License: MIT

1.1.0

11 months ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago