0.2.7 • Published 2 years ago

@strezoski/sts-checkout-dev v0.2.7

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years 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 @strezoski/sts-checkout-dev in your terminal
  2. Require it in a component of your choice with const storeShippers = require("@strezoski/sts-checkout-dev")
  3. Run this line before the loop that populates your shipping options: sts.performSLACheck(shipment_info)
  4. To create an order, forward the selected id from the previous list and run: sts.performOrderCreate("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 ilustrate

// import the package.
const StoreShippers = require("@strezoski/sts-checkout-dev")

// Define your credentials
const BASE_URL = "https://api-staging.storeshippers.com/"
const NONCE_TK = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjg5NCwiZXhwIjoxNzQwNDc3NzkzfQ.pX_9C91EsYht60sMHmXd-9WctV2SibOzgqbMXg2pLeU"

// create the module with yout credentials
sts = new StoreShippers(BASE_URL, NONCE_TK)

// we assume you have all cart information in your state/session
shipment_info = {
    "parcels": {
    "weight": 10,
    "height": 10,
    "width": 10,
    "length": 10,
    "parcel_reference": "item/sku/product_code",
    "size": "l",
    "sales_price": 10
  },
"consignee_dropoff": {
        "email": "stan@storeshippers.com",
        "title": "Ms.",
        "first_name": "Stan",
        "last_name": "Marsh",
        "company_name": "",
        "phone_number": "+31612345678",
        "address": "Willem Beukelsstraat",
        "address_1": "",
        "house_number": 1,
        "house_number_extension": "",
        "city": "Amsterdam",
        "state": "Noord Holland",
        "post_code": "1097CP",
        "country": "NL",
        "point": {"x": 4.9258166, "y": 52.3537077}
    }   
}

// Perform the SLA check with the data in your state and in this case log it to the console.
sts.performSLACheck(shipment_info).then(function(resp){return resp});
// Perform a pickup/dropoff point check with the same payload.
sts.performPUDORetrieval(shipment_info).then(function(resp){return resp});
// Create an order using the returned id
sts.performOrderCreate("da7553ee-cd18-493d-9833-f9afa872c4ae")

License

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

License: MIT

0.2.1

2 years ago

0.2.0

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.1.4

2 years ago

0.1.5

2 years ago

0.1.2

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago