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:
- Run
npm install @storeshippers/checkout
in your terminal - Require it in a component of your choice with
const storeShippers = require("@storeshippers/checkout")(BASE_URL, NONCE, TOKEN)
- Run this line before the loop that populates your shipping options:
sts.checkoutSlaCheck(shipment_info)
- To create an order, forward the selected id from the previous list and run:
sts.checkoutOrderCreate("da7553ee-cd18-493d-9833-f9afa872c4ae")
Staging Credentials
Name | Type | Default | Description |
---|---|---|---|
BASE_URL | str |
https://api-staging.storeshippers.com/ |
The base URL where all requests are directed to. |
NONCE_TOKEN | str |
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjg5NCwiZXhwIjoxNzQwNDc3NzkzfQ.pX_9C91EsYht60sMHmXd-9WctV2SibOzgqbMXg2pLeU | The 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.