Skip to content

📦 Get shipping rates for orders by Shippo for your moltin store

License

Notifications You must be signed in to change notification settings

moltin/moltin-shippo-rates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

moltin-shippo-rates

📦 Get shipping rates for orders by Shippo

Deploy to now

Asynchronous microservice that returns shipping rates from Shippo for given from and to addresses and parcel info. Built with Micro 🤩

🛠 Setup

Both a moltin and Shippo account are needed for this to function.

Create a .env at the project root with the following credentials.

MOLTIN_SECRET_KEY=
SHIPPO_PRIVATE_KEY=

npm install

npm run dev

⛽️ Usage

Once you have the function deployed, take a note of the immutable now.sh url.

You can use this URL to make requests, providing you send along X-MOLTIN-SECRET-KEY in the request header that is the same you defined in .env. You may wish to invoke this function server side so you don't expose your MOLTIN_SECRET_KEY but you could remove this feature entirely.

Send a request to http://localhost:3000 that includes the following payload

{
  "from": {
    "name": "...",
    "company": "...",
    "street1": "...",
    "city": "...",
    "state": "...",
    "zip": "...",
    "country": "...",
    "phone": "...",
    "email": "..."
  },
  "to": {
    "name": "...",
    "company": "...",
    "street1": "...",
    "city": "...",
    "state": "...",
    "zip": "...",
    "country": "...",
    "phone": "...",
    "email": "..."
  },
  "parcels": [
    {
      "length": "5",
      "width": "5",
      "height": "5",
      "distance_unit": "in",
      "weight": "2",
      "mass_unit": "lb"
    }
  ]
}

🚀 Deploy

You can easily deploy this function to now.

About

📦 Get shipping rates for orders by Shippo for your moltin store

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published