Code Monkey home page Code Monkey logo

shippo-node-client's Introduction

Shippo Node.js API wrapper


โš ๏ธ Shippo no longer actively maintains this library

Use our latest Shippo JavaScript SDK ๐Ÿš€


npm version Build Status

Shippo is a shipping API that connects you with multiple shipping carriers (such as USPS, UPS, DHL, Canada Post, Australia Post, UberRUSH and many others) through one interface.

Print a shipping label in 10 mins using our default USPS and DHL Express accounts. No need to register for a carrier account to get started.

You will need to register for a Shippo account to use the Shippo API. It's free to sign up, free to use the API. Only pay to print a live label, test labels are free.

Installation:

You can install this package by running the following command:

  npm install shippo

This means, you don't actually have to download this repository. If you wish to make modifications to the wrapper, you can clone this repository into your project.

Requirements:

The shippo Node.js has no additional dependencies.

Usage:

Initialize your shippo instance using your Private Auth Token provided to you on the API page in the Shippo Dashboard.

    var shippo = require('shippo')('<YOUR_PRIVATE_KEY>');

The snippet below demonstrates how to create an address object (a Shippo Resource). Check examples.js for more detailed example for generating a shipping label:

    var shippo = require('shippo')('<YOUR_PRIVATE_KEY>');

    shippo.address.create({
          'name' : 'Mr Hippo',
          'company' : 'SF Zoo',
          'street1' : '2945 Sloat Blvd',
          'city' : 'San Francisco',
          'state' : 'CA',
          'zip' : '94132',
          'country' : 'US',
          'phone' : '+1 555 341 9393',
          'email' : '[email protected]'
    }).then(function(address){
      console.log("shipment : %s", JSON.stringify(address));
    });

International Multipiece Shipment Example

This example demonstrates how to purchase a label for an international shipment. Creating domestic shipment would follow a similiar proccess but would not require the creation of CustomsItems and CustomsDeclaration objects.

var addressFrom  = {
	"name":"Ms Hippo",
	"company":"Shippo",
	"street1":"215 Clayton St.",
	"city":"San Francisco",
	"state":"CA",
	"zip":"94117",
	"country":"US", //iso2 country code
	"phone":"+1 555 341 9393",
	"email":"[email protected]",
};

// example address_to object dict
var addressTo = {
	"name":"Ms Hippo",
	"company":"Shippo",
	"street1":"803 Clayton St.",
	"city":"San Francisco",
	"state":"CA",
	"zip":"94117",
	"country":"US", //iso2 country code
	"phone":"+1 555 341 9393",
	"email":"[email protected]",
};

// parcel object dict
var parcelOne = {
	"length":"5",
	"width":"5",
	"height":"5",
	"distance_unit":"in",
	"weight":"2",
	"mass_unit":"lb"
};

var parcelTwo = {
    "length":"5",
    "width":"5",
    "height":"5",
    "distance_unit":"in",
    "weight":"2",
    "mass_unit":"lb"
};

var shipment = {
    "address_from": addressFrom,
    "address_to": addressTo,
    "parcels": [parcelOne, parcelTwo],
};

shippo.transaction.create({
	"shipment": shipment,
	"servicelevel_token": "ups_ground",
	"carrier_account": "558c84bbc25a4f609f9ba02da9791fe4",
	"label_file_type": "png"
})
.then(function(transaction) {
    shippo.transaction.list({
      "rate": transaction.rate
    })
    .then(function(mpsTransactions) {
        mpsTransactions.results.forEach(function(mpsTransaction){
            if(mpsTransaction.status == "SUCCESS") {
                console.log("Label URL: %s", mpsTransaction.label_url);
                console.log("Tracking Number: %s", mpsTransaction.tracking_number);
            } else {
                // hanlde error transactions
                console.log("Message: %s", mpsTransactions.messages);
            }
        });
    })
}, function(err) {
    // Deal with an error
    console.log("There was an error creating transaction : %s", err.detail);
});

Tests:

Requirements:

For the test cases the following packages are required:

  npm install mocha
  npm install chai
  npm install mocha-as-promised
  npm install chai-as-promised

Credits

This project was influenced by the excellent stripe-node.

Documentation

Please see https://goshippo.com/docs for up-to-date documentation.

About Shippo

Connect with multiple different carriers, get discounted shipping labels, track parcels, and much more with just one integration. You can use your own carrier accounts or take advantage of our discounted rates with the USPS and DHL Express. Using Shippo makes it easy to deal with multiple carrier integrations, rate shopping, tracking and other parts of the shipping workflow. We provide the API and dashboard for all your shipping needs.

Supported Features

The Shippo API provides in depth support of carrier and shipping functionalities. Here are just some of the features we support through the API:

  • Shipping rates & labels
  • Tracking for any shipment with just the tracking number
  • Batch label generation
  • Multi-piece shipments
  • Manifests and SCAN forms
  • Customs declaration and commercial invoicing
  • Address verification
  • Signature and adult signature confirmation
  • Consolidator support including:
    • DHL eCommerce
    • UPS Mail Innovations
    • FedEx Smartpost
  • Additional services: cash-on-delivery, certified mail, delivery confirmation, and more.

shippo-node-client's People

Contributors

adriancollinsshippo avatar bchui avatar brandonros avatar coen-hyde avatar epistemancer avatar eyoel avatar guozhen-la avatar jfriedr avatar mnowik avatar mootrichard avatar mylifeisshan avatar robertherhold avatar sbeidas avatar smithjason avatar smkrz avatar tbg avatar vyshakhbabji avatar zarlengotoptal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shippo-node-client's Issues

Rates retrieve method does not return individual rates

Rates retrieve does not work. Method does not return individual shipping rates, nor it expects individual shipment object id.

Documentation: https://goshippo.com/docs/reference/js#rates-retrieve

Expectations:
Providing object id (which was created using shippo.shipment.create) and getting single rate as referenced in the doc.
Request will be send to https://api.goshippo.com/rates/ as per documentation.

Actual behaviour:
const shippingRate = await shippo.shipment.retrieve(shippingRateId);

{
    type: 'ShippoNotFoundError',
    code: undefined,
    detail: { detail: 'Not found' },
    path: '/shipments/a58a355b5eb94522ac89d357be2b916d',
    statusCode: 404
}

It seems that shippo.shipment.retrieve method actually does not expects shippingRateId ... instead it expects shipping id. If I provide shipping id, it simply returns all shipping rates, which is different behaviour then explained within documentation.

Request is sent to the https://api.goshippo.com/shipments/

Ability to create shipments on behalf of Oauth users

According to https://goshippo.com/docs/oauth/ , you must use "Bearer" instead of "ShippoToken" in the Authorization header.

So, a quick hack:

(Mind the coffee script)

ShippoResource = require('shippo/lib/Resource')
getHeaderOriginal = ShippoResource::_get_headers
ShippoResource::_get_headers = (data) ->
  output = getHeaderOriginal.apply this, arguments
  console.log 'cooool, it saved', @_shippo.get('oauthToken')
  if @_shippo.get('oauthToken')
    output.Authorization = 'Bearer ' + @_shippo.get('oauthToken')
  return output


shippo = require('shippo')('any api key, no longer used')
shippo.set('oauthToken', user.shippo_token)

# make normal requests like
shippo.shipment.create {...}

Shall I make a PR to implement something like this?
Would it be better off to just allow

shippo = require('shippo')('oauth.abc1234')

And detect the string starting with oauth... and therefore simply use Bearer instead of ShippoToken?

@types/shippo is not thesame with the docs and postman collection

@types/shippo in not the same with docs.

Example
Docs and API response:

shippo.address.create({

 "name":"Shawn Ippotle", 

 "company":"Shippo",

 "street1":"215 Clayton St.",

 "city":"San Francisco",

 "state":"CA",

 "zip":"94117",

 "country":"US",

 "email":"[email protected]",

 "validate": true

}, function(err, address) {

 // asynchronously called

});

@types/shippo:

this.shippo.address
      .create({
        name: 'Shawn Ippotle',
        street1: '215 Clayton St.',
        city: 'San Francisco',
        state: 'CA',
        zip: '94117',
        country: 'US',
        validate: true,
      })
      .then(async (res) => {
          .........

when I try to include other values, it brings value does not exist on type create e.g email and company does exist on the type

Address validation - shippo.address.create()

I sent known incorrect address data to test address validation:

street1=166 sylvan ave (number 166 does not exist)
city=san mateoo (too many 'o's.. should be 'san mateo')
state=CA
zip=94401 (correct zip is 94403)
country=US

The API response returned "is_valid": true, as well as the correct zip and city name:

{
  "data": {
    "object_created": "2017-07-27T03:56:02.918Z",
    "object_updated": "2017-07-27T03:56:03.456Z",
    "object_id": "97586d355f564c3a90519fc0c2fe7ce5",
    "is_complete": true,
    "validation_results": {
      "is_valid": true,    <======================
      "messages": [
        
      ]
    },
    "object_owner": "xxxxxxxxxx",
    "name": "",
    "company": "",
    "street_no": "",
    "street1": "166 SYLVAN AVE",
    "street2": "",
    "street3": "",
    "city": "SAN MATEO",   <======================
    "state": "CA",
    "zip": "94403",   <======================
    "country": "US",
    "longitude": null,
    "latitude": null,
    "phone": "",
    "email": "",
    "is_residential": null,
    "metadata": "",
    "test": true
  }
}

I was expecting "is_valid": false since I submitted incorrect data. Is this by design?

Errors not captured properly handling 4XX or 5XX response codes

When using the debugger during a call with shippo.transaction.create({{PAYLOAD}}), the request seems to fire twice. The first time with a valid payload describing the response, and the second payload only contains { details: 'Permission Denied' }. This breaks a previous contract that says there will be a status field on the response object.

This code is contained in Method.js on line 79.

To recreate, simply add a breakpoint on this line and use the function call shippo.transactions.create() method to see the request fire twice.

Property 'carrieraccount' does not exist on type 'Shippo'

I am having trouble reaching carrieraccount. Ive notice several situations where @types might be out-of-date?

import * as shippoClient from 'shippo';
shippoClient('**').carrieraccount;

results in the following error

Property 'carrieraccount' does not exist on type 'Shippo'.

"@types/shippo": "^1.5.1",
"shippo": "^1.7.1",

Add URI to the Error class

We receive about 3-100 errors from Shippo every day; it would be useful if the error objects contained information about which URI was failing, so we could use this information to escalate to Shippo.

I tried adding this, but got stopped because I wasn't sure about the type of the req variable in makeRequest(), and/or how to get the URI back out in the _responseHandler.

Create Shipment returns empty Rates with async: true

Hi there,

When I make the request to create a shipment in order to retrieve the rates, the rates Array returns empty, but only when using "async": true.

When "async": false is set, the rates Array seems to work fine.

I've searched high, low in the docs, and have tried test key, live key, enabled a payment method, you name it, the async setting on false seems to be the culprit.

What is causing this? It's would be great to keep the integration async all the way.

Thanks!

Batch Shipment creation: "Invalid JSON received from the Shippo API"

Client is throwing ShippoAPIError for batch shipment creation with batch sizes equal or greater than 500. Small batches (1-200) return a valid JSON response.

{
    "type": "ShippoAPIError",
    "message": "Invalid JSON received from the Shippo API"
}

Manually testing large batches shipment requests (>=500) with Postman seem to return valid JSON and I'm able to use the resulting batch shipment.

FedEx API is not responding

Sometimes while fetching the rates api is not responding.

As a response I got

messages:
[ { source: 'FedEx',
code: '',
text: 'FedEx API did not respond. Please try again in a few minutes.' } ],

And if I try after few seconds or a minute, I got the response.

Any suggestion for it?

Pagination support

Many of the Shippo resources are paginated and respond to the page and results params to view data past the initial 10. However, only the Batch resource allows us to specify a page.

For example, carrieraccount.list returns

{ 
  next: 'https://api.goshippo.com/carrier_accounts/?page=2',
  previous: null,
  results: [ [Object], [Object], [Object], [Object], [Object], [Object], [Object], [Object], [Object], [Object]] 
} 

Does this repo provide any way to access data past the first 10 results for any resource besides Batch?

Webhooks Not Sending Request

I have waited for more than 2 hours but I never get a request from webhook saying status has changed. but when I got to api.../track/carrier/tracknumber it will send a request right away.

authentication credentials were not provided.

I'm Trying to get rates of ship but unable to coonect with shippo here is my code snippet.

shippo = require('shippo')('shippo_test_key);

shippo.address.create({
'name' : 'Mr Hippo',
'company' : 'SF Zoo',
'street1' : '2945 Sloat Blvd',
'city' : 'San Francisco',
'state' : 'CA',
'zip' : '94132',
'country' : 'US',
'phone' : '+1 555 341 9393',
'email' : '[email protected]'
}).then(function(address){
console.log("shipment : %s", JSON.stringify(address));
}).catch(err => {
return next(err);
});

This returns
error: type=ShippoAuthenticationError, rawType=undefined, code=undefined, param=undefined, message=Invalid credentials, detail=undefined, message=Invalid credentials

Tag versions

It would be useful if the git repository had tags to match the versions in npm. Calling npm version patch or npm version minor will automatically do this for you.

Buffer() is deprecated

Making a request shows console error (node:2036) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Buffer() is being used on shippo\lib\Resource.js:183 - var requestData = new Buffer(JSON.stringify(data || {})); Changing the line to var requestData = Buffer.alloc(JSON.stringify(data || {})); makes the error go away.

Quote example needed

I want to make a quote shipping rate quote by zip code only.
Can you give me a example code snippet?

ES6 Imports

I'm using TS and ES6 imports with the following:

import * as Shippo from 'shippo';
const shippo = new Shippo('<YOUR_PRIVATE_KEY>');

However, I continue to get 400 response with "Invalid credentials". I've triple checked my credentials. Is this this the proper way to import and set the key with ES6.

*Obviously, I've replaced <YOUR_PRIVATE_KEY> with my actual key.

Expose error constructors

It would be great to have the following Error constructors available on the exported Shippo object. The only way to detect a specific type of error currently is to compare the type property against a string, which isn't ideal.

ShippoNotFoundError
ShippoInvalidRequestError
ShippoAPIError
ShippoAuthenticationError
ShippoConnectionError

Dynamic Code Evaluation on Vercel Edge Functions (Next.js)

I am in process of integrating Shippo into a project, and while everything is working fine locally, turns out the production build when deploying to Vercel fails with the Shippo Node Client. This is because the Vercel Edge Functions do not allow "new function". More detail on this is here:

https://nextjs.org/docs/pages/api-reference/edge#unsupported-apis

Checking the code base, this is done in the /lib/utils.js file:

return new Function(

Function makeInterpolator is used in a few locations, though its not fully clear why. I am still attempting to sort other ways around it (including trying configs to allow the build, but nothing has worked yet. Vercel also mentions if they are actually hit while running on the edge, they will throw an error so even if I get it to build, that doesn't seem ideal.

https://nextjs.org/docs/messages/edge-dynamic-code-evaluation

Anyone have experience with this and if so, any workaround? Thanks!

image

Set the client timeout to a lower value

The default Shippo client timeout is set to 120 seconds. Heroku will terminate requests if they take longer than 30 seconds. No point in waiting around for 90 extra seconds for a response.

ES6 Imports Don't Work

We are able to successfully use Require to use this library, but using imports doesn't work, and unfortunately our current set up requires imports.

Whenever we import, we get 400 response with "Invalid credentials". We know our credential are fine, as we use them daily in another app which uses require. how do you use this library with Imports?

Our code:

import * as Shippo from 'shippo'
const shippo = new Shippo.default('YOURSHIPPOID');

Invalid /parcels response if results=1 parameter passed

GET https://api.goshippo.com/parcels?results=1

Response:

{
   "next":"https://api.goshippo.com/parcels?results=1&page=2",
   "previous":null,
   "results":{
      "object_state":"VALID",
      "object_created":"2020-03-31T18:39:51.357Z",
      "object_updated":"2020-03-31T18:39:51.357Z",
      "object_id":"4f827b0741024ae2a7bcd4ea08155055",
      "object_owner":"[email protected]",
      "template":null,
      "length":"5.0000",
      "width":"5.0000",
      "height":"5.0000",
      "distance_unit":"cm",
      "weight":"2.0000",
      "mass_unit":"lb",
      "value_amount":null,
      "value_currency":null,
      "metadata":"",
      "extra":{

      },
      "line_items":[

      ],
      "test":true
   }
}

The results element in the response must be a JSON-array, not an object.

If the results parameter was set to 2 or more, the response would be a JSON-array, as expected.

Tracking Calls

Hello,

I went through a bit of the API Reference and Guides and couldn't find what API method to use for checking the Tracking Status. Also briefly skimmed through the source code and couldn't find anything related to tracking. Can you tell me what shippo.[insert trackingCall](...) to fetch tracking status of shipments.

Node.js v13+ default timeout changed

Hey there, wanted to point out that under Node.js v13+ the default timeout has changed from 2 minutes to 0. This has the effect of never timing out.

In your current implementation, under Node.js v13, your requests will never timeout on the client side.

The change would need to be made here:

Shippo.DEFAULT_TIMEOUT = require('http').createServer().timeout;

You can hardcode the previous value of 120000 if you want to preserve the behavior of previous Node.js versions (this value has been 120000 since it was introduced to Node.js, until the recent change).

I opened #56 with the proposed change.

I've been searching Github for codebases that rely on this timeout value and manually opening issues/PRs like this. My intent is to bring your attention to this subtle change and let you decide if it's necessary to address โค๏ธ

Transaction list returns null for multi-piece shipments

After creating a label transaction for a multi-piece shipment with a rate object_id, I am calling shippo.transactions.list with the rate object_id to get the additional labels, but it always returns null. I have also tried it using the object_id returned in the transaction. I get the first label as normal when the transaction is created.

I also tried it on curl and get the same result:

https://api.goshippo.com/transactions/?rate=<rate object_id> -H "Authorization: ShippoToken shippo_test_xxxxxxxxxxxxxxxxxx"

Does this not work in test mode or am I not using the right object_id?

Thank you!

Unable to resolve module "http"

Hello all,

I am having an issue with this package. Every time I try build the app it crashes and gives me an error. To reproduce the following error I simply have to import shippo. I attempted both versions.

import shippo from "shippo" and const shippo = require('shippo')

Screenshot_1660115473

At first I thought it was because I didn't have the package installed so I tried installing it however, that didn't help at all. Then I tried looking for the file that is being imported from the Resources.js (shippo file) which seems to detect "http" inside @types/node folder. So I suspect that there is some kind of issue that causes "shippo" to not resolve the "http" module. Lastly, most of the time it is the "http" module but sometimes it is "path".
Pls help been stuck on this for that past week trying to figure out the issue.

If any more information is needed let me know.

I am running React Native on 0.68.2 and Shippo is on 1.7.1.

Error message "Not found" from carrier

Hi guys, I wasn't sure where else to post this for support.

I'm having an issue with the Shippo API that seems impossible to debug.

When using an Australia Post carrier accounts, I donโ€™t seem to be getting any meaningful error messaging.
When requesting rates for a shipment via Shippo, I receive this error:

messages: [ { source: 'AustraliaPost', code: '', text: 'Not found' } ],

After some investigation using Australia Postโ€™s API directly, I intentionally got it to throw an error by omitting the length from a request and found the following response returns a 404 with the payload here:

{
 "data": {
  "error": {
   "errorMessage": "Please enter Length."
  }
 },
 "status": 404,
 "config": {
  "method": "POST",
  "transformRequest": [
   null
  ],
  "transformResponse": [
   null
  ],
  "jsonpCallbackParam": "callback",
  "url": "/backend/proxy/get/pac/postage/parcel/domestic/service.json",
  "params": {
   "from_postcode": "2008",
   "to_postcode": "2034",
   "length": "",
   "width": "1",
   "height": "1",
   "weight": "2.4"
  },
  "headers": {
   "AUTH-KEY": "adca17df-9cb8-43dc-8004-3e98ec4988b4",
   "Accept": "application/json, text/plain, */*",
   "X-XSRF-TOKEN": "60389296-9e72-40c0-9efe-ad6f86f836c6"
  }
 },
 "statusText": "Not Found",
 "xhrStatus": "complete"
}

Shippo is returning the statusText of the response instead of the error message which makes it impossible to know what the specific issue with my request is. The default carrier accounts seem to accept the address and parcel information so I'm at a loss of how to workout what the issue is.

It also seems that if I manually create an order in Shippo and request rates the Shippo app itself returns the same error:

image

Is there a way I can debug the issue in Shippo? Is there a way to access more information? I seem to be stuck with the lack of possible directions I can go to continue to troubleshoot this problem.

Thanks guys.

Getting "The data you sent was not accepted as valid" on valid Rate ID

I am trying to test your transactions endpoint to purchase a label, however it keeps returning that my data was not valid.
Which is strange, because when I fetch the shipment by ID, I can clearly see that it contains the rate that I am trying to purchase.
Is there something I am missing?

This is what I am sending:
{ rate: 'a56493b1f836482e94b89fb9d6261267', label_file_type: 'PDF', async: false }
This is my implementation:

shippo_instance.transaction.create({
    rate: rate_id,
    label_file_type: "PDF",
    async: false
  }, async (error, transaction) => {
    if (error) return res.send(create_api_message("danger", error.message))

    try {
      const label = await shippo_instance.transaction.retrieve(transaction.object_id);
  
      res.send(label)
    } catch ({ message }) {
      res.send(create_api_message("danger", message))
    }
  });

Any way to get Enums through the API

Is there any way for me to programmatically fetch the Enums available through the API?
I'm looking to get the Service Levels and Parcel Templates specifically

Or do I need to enter all of these manually into my application so my users can select which one they want to use?

.catch() does not work

Hello,

This package appears to be using a nonstandard promise implementation library called when. In particular, when I try to chain the promises returned by these functions with native JS promises, I get errors since they do not support the catch method (and probably others as well). Would it make sense to move this library to a more standard promises implementation--native JS promises with a polyfill, or bluebird?

Thank you.

Canada multiparcels empty response

Hi,
I am trying to setup a multiparcel shipment. My account has fedex integration and everything works fine for US and other international addresses, except for Canada. This is my request in curl (I am using the last Rest API 2017-03-29 and I got the same empty array rate list response in node):

curl https://api.goshippo.com/shipments/  \
-H "Content-Type: application/json" \
-H "Authorization: ShippoToken shippo_live_XXXXXXX"  \
-H "Shippo-API-Version: 2017-03-29" \
-d '{
  "object_purpose": "QUOTE",
  "address_from": {
    "name": "Burguer King",
    "street1": "2397 W Belleview Ave,",
    "city": "Littleton",
    "state": "CO",
    "zip": "80120",
    "country": "US",
    "phone": "1234567890",
    "email": "[email protected]",
    "object_purpose": "QUOTE"
  },
  "address_to": {
    "name": "Random",
    "company": "",
    "street1": "5300 Rue Jean-Talon Ouest, Montreal",
    "street2": "",
    "city": "Montreal",
    "state": "QC",
    "zip": "H4P 2T5",
    "country": "CA",
    "phone": "6158328555",
    "email": "[email protected]",
    "object_purpose": "QUOTE"
  },
  "parcels": [{
    "length": "18",
    "width": "13",
    "height": "12",
    "distance_unit": "in",
    "weight": "50",
    "mass_unit": "lb"
  },
  {
    "length": "14",
    "width": "11",
    "height": "6",
    "distance_unit": "in",
    "weight": "14",
    "mass_unit": "lb"
  }],
  "async": false,
  "customs_declaration": {
    "contents_type": "MERCHANDISE",
    "contents_explanation": "Shipping done easy",
    "non_delivery_option": "RETURN",
    "certify": true,
    "certify_signer": "Shippo",
    "items": [
      {
        "description": "My Parcel",
        "quantity": 1,
        "net_weight": "64",
        "mass_unit": "lb",
        "value_amount": 890.0600000000003,
        "value_currency": "USD",
        "metadata": "Your first Customs Item",
        "origin_country": "US"
      }
    ],
    "metadata": "Your first Customs Declaration"
  },
  "insurance_amount": 0,
  "insurance_currency": "USD"
}'

And this is my response:

{  
   "carrier_accounts":[  

   ],
   "object_created":"2017-07-13T16:27:44.492Z",
   "object_updated":"2017-07-13T16:27:44.492Z",
   "object_id":"436c9a73a6b64a50824aa7e067ce1acb",
   "object_owner":"XXXX",
   "status":"QUEUED",
   "address_from":{  
      "object_id":"70ecbc35d67e4de7aedf1cf8332fbc2d",
      "is_complete":false,
      "name":"Burguer King",
      "company":"",
      "street_no":"",
      "street1":"2397 W Belleview Ave,",
      "validation_results":{  

      },
      "street2":"",
      "street3":"",
      "city":"Littleton",
      "state":"CO",
      "zip":"80120",
      "country":"US",
      "phone":"1234567890",
      "is_residential":null,
      "test":false
   },
   "address_to":{  
      "object_id":"454d45f8ffd84a918de19233bf58c1d5",
      "is_complete":false,
      "name":"Random",
      "company":"",
      "street_no":"",
      "street1":"5300 Rue Jean-Talon Ouest, Montreal",
      "validation_results":{  

      },
      "street2":"",
      "street3":"",
      "city":"Montreal",
      "state":"QC",
      "zip":"H4P 2T5",
      "country":"CA",
      "phone":"6158328555",
      "is_residential":null,
      "test":false
   },
   "parcels":[  
      {  
         "object_state":"VALID",
         "object_created":"2017-07-13T16:27:44.403Z",
         "object_updated":"2017-07-13T16:27:44.512Z",
         "object_id":"eb6d416b38ab4695be4164d7dbd661d5",
         "object_owner":"XXXX",
         "template":null,
         "extra":{  

         },
         "length":"18.0000",
         "width":"13.0000",
         "height":"12.0000",
         "distance_unit":"in",
         "weight":"50.0000",
         "mass_unit":"lb",
         "value_amount":null,
         "value_currency":null,
         "metadata":"",
         "line_items":[  

         ],
         "test":false
      },
      {  
         "object_state":"VALID",
         "object_created":"2017-07-13T16:27:44.416Z",
         "object_updated":"2017-07-13T16:27:44.524Z",
         "object_id":"330b70f04269451fb3b8a4c915cd4323",
         "object_owner":"XXXX",
         "template":null,
         "extra":{  

         },
         "length":"14.0000",
         "width":"11.0000",
         "height":"6.0000",
         "distance_unit":"in",
         "weight":"14.0000",
         "mass_unit":"lb",
         "value_amount":null,
         "value_currency":null,
         "metadata":"",
         "line_items":[  

         ],
         "test":false
      }
   ],
   "shipment_date":"2017-07-13T16:27:44.402Z",
   "address_return":{  
      "object_id":"70ecbc35d67e4de7aedf1cf8332fbc2d",
      "is_complete":false,
      "name":"Burguer King",
      "company":"",
      "street_no":"",
      "street1":"2397 W Belleview Ave,",
      "validation_results":{  

      },
      "street2":"",
      "street3":"",
      "city":"Littleton",
      "state":"CO",
      "zip":"80120",
      "country":"US",
      "phone":"1234567890",
      "is_residential":null,
      "test":false
   },
   "customs_declaration":"e177247f08e348a4bb3b2d8871c3ba15",
   "extra":{  

   },
   "rates":[  

   ],
   "messages":[  

   ],
   "metadata":"",
   "test":false
}

If I send a single parcel request, I got a valid result:
The request:

curl https://api.goshippo.com/shipments/  \
-H "Content-Type: application/json" \
-H "Authorization: ShippoToken shippo_live_XXXX"  \
-H "Shippo-API-Version: 2017-03-29" \
-d '{
  "object_purpose": "QUOTE",
  "address_from": {
    "name": "Burguer King",
    "street1": "2397 W Belleview Ave,",
    "city": "Littleton",
    "state": "CO",
    "zip": "80120",
    "country": "US",
    "phone": "1234567890",
    "email": "[email protected]",
    "object_purpose": "QUOTE"
  },
  "address_to": {
    "name": "Random",
    "company": "",
    "street1": "5300 Rue Jean-Talon Ouest, Montreal",
    "street2": "",
    "city": "Montreal",
    "state": "QC",
    "zip": "H4P 2T5",
    "country": "CA",
    "phone": "6158328555",
    "email": "[email protected]",
    "object_purpose": "QUOTE"
  },
  "parcels": [{
    "length": "18",
    "width": "13",
    "height": "12",
    "distance_unit": "in",
    "weight": "50",
    "mass_unit": "lb"
  }],
  "async": false,
  "customs_declaration": {
    "contents_type": "MERCHANDISE",
    "contents_explanation": "Shipping done easy",
    "non_delivery_option": "RETURN",
    "certify": true,
    "certify_signer": "Shippo",
    "items": [
      {
        "description": "My Parcel",
        "quantity": 1,
        "net_weight": "50",
        "mass_unit": "lb",
        "value_amount": 890.0600000000003,
        "value_currency": "USD",
        "metadata": "Your first Customs Item",
        "origin_country": "US"
      }
    ],
    "metadata": "Your first Customs Declaration"
  },
  "insurance_amount": 0,
  "insurance_currency": "USD"
}'

And the response:

{  
   "carrier_accounts":[  

   ],
   "object_created":"2017-07-13T16:36:58.549Z",
   "object_updated":"2017-07-13T16:36:58.549Z",
   "object_id":"2bc4f52c06b349d195ca7044d032f20d",
   "object_owner":"XXX",
   "status":"SUCCESS",
   "address_from":{  
      "object_id":"7e82b6eda8354315889b31c22b8ddebe",
      "is_complete":false,
      "name":"Burguer King",
      "company":"",
      "street_no":"",
      "street1":"2397 W Belleview Ave,",
      "validation_results":{  

      },
      "street2":"",
      "street3":"",
      "city":"Littleton",
      "state":"CO",
      "zip":"80120",
      "country":"US",
      "phone":"1234567890",
      "is_residential":null,
      "test":false
   },
   "address_to":{  
      "object_id":"b5e4ab73bda24367bd9f9453b832c56e",
      "is_complete":false,
      "name":"Random",
      "company":"",
      "street_no":"",
      "street1":"5300 Rue Jean-Talon Ouest, Montreal",
      "validation_results":{  

      },
      "street2":"",
      "street3":"",
      "city":"Montreal",
      "state":"QC",
      "zip":"H4P 2T5",
      "country":"CA",
      "phone":"6158328555",
      "is_residential":null,
      "test":false
   },
   "parcels":[  
      {  
         "object_state":"VALID",
         "object_created":"2017-07-13T16:36:58.495Z",
         "object_updated":"2017-07-13T16:36:58.561Z",
         "object_id":"222eb6fb4cf64188bd52d396cbb512ac",
         "object_owner":"XXX",
         "template":null,
         "extra":{  

         },
         "length":"18.0000",
         "width":"13.0000",
         "height":"12.0000",
         "distance_unit":"in",
         "weight":"50.0000",
         "mass_unit":"lb",
         "value_amount":null,
         "value_currency":null,
         "metadata":"",
         "line_items":[  

         ],
         "test":false
      }
   ],
   "shipment_date":"2017-07-13T16:36:58.495Z",
   "address_return":{  
      "object_id":"7e82b6eda8354315889b31c22b8ddebe",
      "is_complete":false,
      "name":"Burguer King",
      "company":"",
      "street_no":"",
      "street1":"2397 W Belleview Ave,",
      "validation_results":{  

      },
      "street2":"",
      "street3":"",
      "city":"Littleton",
      "state":"CO",
      "zip":"80120",
      "country":"US",
      "phone":"1234567890",
      "is_residential":null,
      "test":false
   },
   "customs_declaration":"5238ff2c03644d2fa334967f19770a8f",
   "extra":{  

   },
   "rates":[  
      {  
         "object_created":"2017-07-13T16:36:59.567Z",
         "object_id":"8085fd203d514fc38a1e3f31194ea617",
         "object_owner":"XXXX",
         "shipment":"2bc4f52c06b349d195ca7044d032f20d",
         "attributes":[  
            "BESTVALUE",
            "CHEAPEST"
         ],
         "amount":"76.36",
         "currency":"USD",
         "amount_local":"97.36",
         "currency_local":"CAD",
         "provider":"FedEx",
         "provider_image_75":"https://shippo-static.s3.amazonaws.com/providers/75/FedEx.png",
         "provider_image_200":"https://shippo-static.s3.amazonaws.com/providers/200/FedEx.png",
         "servicelevel":{  
            "name":"Ground",
            "token":"fedex_ground",
            "terms":""
         },
         "days":4,
         "arrives_by":null,
         "duration_terms":"",
         "messages":[  

         ],
         "carrier_account":"1bce1c5b1bf840668670eaeab8702250",
         "test":false,
         "zone":"51"
      },
      {  
         "object_created":"2017-07-13T16:36:59.566Z",
         "object_id":"5133924de4cd4b7abd3396d2ca261fa4",
         "object_owner":"XXX",
         "shipment":"2bc4f52c06b349d195ca7044d032f20d",
         "attributes":[  

         ],
         "amount":"110.13",
         "currency":"USD",
         "amount_local":"140.41",
         "currency_local":"CAD",
         "provider":"FedEx",
         "provider_image_75":"https://shippo-static.s3.amazonaws.com/providers/75/FedEx.png",
         "provider_image_200":"https://shippo-static.s3.amazonaws.com/providers/200/FedEx.png",
         "servicelevel":{  
            "name":"International Economy",
            "token":"fedex_international_economy",
            "terms":""
         },
         "days":4,
         "arrives_by":null,
         "duration_terms":"0:00 A.M. IF NO CUSTOMS DELAY",
         "messages":[  

         ],
         "carrier_account":"1bce1c5b1bf840668670eaeab8702250",
         "test":false,
         "zone":"US001O"
      },
      {  
         "object_created":"2017-07-13T16:36:59.566Z",
         "object_id":"33f2a81d925e4939a82b2d001a76435f",
         "object_owner":"XXXX",
         "shipment":"2bc4f52c06b349d195ca7044d032f20d",
         "attributes":[  
            "FASTEST"
         ],
         "amount":"126.76",
         "currency":"USD",
         "amount_local":"161.62",
         "currency_local":"CAD",
         "provider":"FedEx",
         "provider_image_75":"https://shippo-static.s3.amazonaws.com/providers/75/FedEx.png",
         "provider_image_200":"https://shippo-static.s3.amazonaws.com/providers/200/FedEx.png",
         "servicelevel":{  
            "name":"International Priority",
            "token":"fedex_international_priority",
            "terms":""
         },
         "days":2,
         "arrives_by":null,
         "duration_terms":"0:00 A.M. IF NO CUSTOMS DELAY",
         "messages":[  

         ],
         "carrier_account":"1bce1c5b1bf840668670eaeab8702250",
         "test":false,
         "zone":"US001O"
      }
   ],
   "messages":[  
      {  
         "source":"FedEx",
         "code":"820",
         "text":"NOTE: The destination state/province code has been changed.  "
      },
      {  
         "source":"FedEx",
         "code":"886",
         "text":"NOTE: Money Back Guarantee is not eligible for this pick up/delivery postal/zip code. "
      }
   ],
   "metadata":"",
   "test":false
}

Thanks in advance

question: is there are way to do multi-parcel shipments ?

Is it possible to make multi-parcel shipments using shippo-node-client?
I'm currently working on an app the needs to guarantee multiple parcels are delivered together on the same date and have the ability to track them as a single service request.

multiple parcels returns empty rates list

Getting rates via the shipment API works fine for one parcel, but including anymore than 1 parcel always returns and empty rates_list.

cURL example right from the docs:

curl https://api.goshippo.com/shipments/  \
    -H "Authorization: ShippoToken <my_token>" \
    -H "Content-Type: application/json"  \
    -d '{
            "object_purpose": "PURCHASE",
            "address_from": {
                "object_purpose": "PURCHASE",
                "name": "Mr. Hippo",
                "street1": "215 Clayton St.",
                "city": "San Francisco",
                "state": "CA",
                "zip": "94117",
                "country": "US",
                "phone": "+1 555 341 9393",
                "email": "[email protected]"
            },
            "address_to": {
                "object_purpose": "PURCHASE",
                "name": "Mrs. Hippo",
                "street1": "965 Mission St.",
                "city": "San Francisco",
                "state": "CA",
                "zip": "94105",
                "country": "US",
                "phone": "+1 555 341 9393",
                "email": "[email protected]"
            },
            "parcel": [
                {
                    "length": "5",
                    "width": "5",
                    "height": "5",
                    "distance_unit": "in",
                    "weight": "2",
                    "mass_unit": "lb"
                },
                {
                    "length": "10",
                    "width": "10",
                    "height": "10",
                    "distance_unit": "in",
                    "weight": "2",
                    "mass_unit": "lb"
                }
            ],
            "async": false
        }'

return:

{
  "carrier_accounts": [
    
  ],
  "object_created": "2016-11-03T23:25:17.931Z",
  "object_updated": "2016-11-03T23:25:17.931Z",
  "object_id": "935abf975a534d5f95fe8e58a798726f",
  "object_owner": "[email protected]",
  "object_state": "VALID",
  "object_status": "SUCCESS",
  "object_purpose": "PURCHASE",
  "address_from": "4deec73f215e47f4a8c86cb2aeaa0ddb",
  "address_to": "089dd22f627b4ff6953c7bc1bbd63854",
  "parcel": [
    "1ccf777bf4fe452a84c9917aa9cfb3b5",
    "b227467a4dd94c7083933beada3391d9"
  ],
  "submission_type": "DROPOFF",
  "submission_date": "2016-11-03T23:25:17.907Z",
  "address_return": "4deec73f215e47f4a8c86cb2aeaa0ddb",
  "return_of": null,
  "customs_declaration": null,
  "insurance_amount": "0",
  "insurance_currency": null,
  "extra": {
    
  },
  "reference_1": "",
  "reference_2": "",
  "rates_url": "https:\/\/api.goshippo.com\/shipments\/935abf975a534d5f95fe8e58a798726f\/rates\/",
  "rates_list": [
    
  ],
  "messages": [
    
  ],
  "metadata": "",
  "test": true
}

Nothing in rates_list

but with just 1 parcel:

curl https://api.goshippo.com/shipments/  \
    -H "Authorization: ShippoToken <my_token" \
    -H "Content-Type: application/json"  \
    -d '{
            "object_purpose": "PURCHASE",
            "address_from": {
                "object_purpose": "PURCHASE",
                "name": "Mr. Hippo",
                "street1": "215 Clayton St.",
                "city": "San Francisco",
                "state": "CA",
                "zip": "94117",
                "country": "US",
                "phone": "+1 555 341 9393",
                "email": "[email protected]"
            },
            "address_to": {
                "object_purpose": "PURCHASE",
                "name": "Mrs. Hippo",
                "street1": "965 Mission St.",
                "city": "San Francisco",
                "state": "CA",
                "zip": "94105",
                "country": "US",
                "phone": "+1 555 341 9393",
                "email": "[email protected]"
            },
            "parcel": [
                {
                    "length": "5",
                    "width": "5",
                    "height": "5",
                    "distance_unit": "in",
                    "weight": "2",
                    "mass_unit": "lb"
                }
            ],
            "async": false
        }'

return:

{
  "carrier_accounts": [
    
  ],
  "object_created": "2016-11-03T23:26:57.620Z",
  "object_updated": "2016-11-03T23:26:57.620Z",
  "object_id": "6378f0777b2048149fbdf036316f3469",
  "object_owner": "[email protected]",
  "object_state": "VALID",
  "object_status": "SUCCESS",
  "object_purpose": "PURCHASE",
  "address_from": "249bda3916d04511ad4be56855996860",
  "address_to": "87a8e8ddde484c7e9e708014654a463e",
  "parcel": "aa84b1924d1b4183bd2e0287c7d28e56",
  "submission_type": "DROPOFF",
  "submission_date": "2016-11-03T23:26:57.600Z",
  "address_return": "249bda3916d04511ad4be56855996860",
  "return_of": null,
  "customs_declaration": null,
  "insurance_amount": "0",
  "insurance_currency": null,
  "extra": {
    
  },
  "reference_1": "",
  "reference_2": "",
  "rates_url": "https:\/\/api.goshippo.com\/shipments\/6378f0777b2048149fbdf036316f3469\/rates\/",
  "rates_list": [
    {
      "object_state": "VALID",
      "object_purpose": "PURCHASE",
      "object_created": "2016-11-03T23:26:59.044Z",
      "object_updated": "2016-11-03T23:26:59.044Z",
      "object_id": "4ff9f22c9a784f69a77ec7dd98f41ce6",
      "object_owner": "[email protected]",
      "shipment": "6378f0777b2048149fbdf036316f3469",
      "available_shippo": true,
      "attributes": [
        "CHEAPEST"
      ],
      "amount": "5.00",
      "currency": "USD",
      "amount_local": "5.00",
      "currency_local": "USD",
      "provider": "UberRUSH",
      "provider_image_75": "https:\/\/shippo-static.s3.amazonaws.com\/providers\/75\/uber.png",
      "provider_image_200": "https:\/\/shippo-static.s3.amazonaws.com\/providers\/200\/uber.png",
      "servicelevel_name": "On-demand",
      "servicelevel_token": null,
      "servicelevel_terms": "",
      "days": 0,
      "arrives_by": null,
      "duration_terms": "",
      "trackable": false,
      "insurance": false,
      "insurance_amount_local": "0.00",
      "insurance_currency_local": null,
      "insurance_amount": "0.00",
      "insurance_currency": null,
      "delivery_attempts": null,
      "outbound_endpoint": "door",
      "inbound_endpoint": "door",
      "messages": [
        
      ],
      "carrier_account": "0f13d27727dd41e7aca573324d534db9",
      "test": true
    },
    {
      "object_state": "VALID",
      "object_purpose": "PURCHASE",
      "object_created": "2016-11-03T23:26:57.816Z",
      "object_updated": "2016-11-03T23:26:57.816Z",
      "object_id": "ba5beddfdf8744aa89c1dda8bdd18af9",
      "object_owner": "[email protected]",
      "shipment": "6378f0777b2048149fbdf036316f3469",
      "available_shippo": true,
      "attributes": [
        
      ],
      "amount": "20.66",
      "currency": "USD",
      "amount_local": "20.66",
      "currency_local": "USD",
      "provider": "USPS",
      "provider_image_75": "https:\/\/shippo-static.s3.amazonaws.com\/providers\/75\/USPS.png",
      "provider_image_200": "https:\/\/shippo-static.s3.amazonaws.com\/providers\/200\/USPS.png",
      "servicelevel_name": "Priority Mail Express",
      "servicelevel_token": "usps_priority_express",
      "servicelevel_terms": "",
      "days": 2,
      "arrives_by": null,
      "duration_terms": "Overnight delivery to most U.S. locations.",
      "trackable": true,
      "insurance": false,
      "insurance_amount_local": "0.00",
      "insurance_currency_local": null,
      "insurance_amount": "0.00",
      "insurance_currency": null,
      "delivery_attempts": null,
      "outbound_endpoint": "door",
      "inbound_endpoint": "door",
      "messages": [
        
      ],
      "carrier_account": "e7170e72590f42268e48d15ae3dacc7d",
      "test": true
    },
    {
      "object_state": "VALID",
      "object_purpose": "PURCHASE",
      "object_created": "2016-11-03T23:26:57.815Z",
      "object_updated": "2016-11-03T23:26:57.815Z",
      "object_id": "7fa05206a77b48b895339f082fe7c50f",
      "object_owner": "[email protected]",
      "shipment": "6378f0777b2048149fbdf036316f3469",
      "available_shippo": true,
      "attributes": [
        "BESTVALUE"
      ],
      "amount": "5.81",
      "currency": "USD",
      "amount_local": "5.81",
      "currency_local": "USD",
      "provider": "USPS",
      "provider_image_75": "https:\/\/shippo-static.s3.amazonaws.com\/providers\/75\/USPS.png",
      "provider_image_200": "https:\/\/shippo-static.s3.amazonaws.com\/providers\/200\/USPS.png",
      "servicelevel_name": "Priority Mail",
      "servicelevel_token": "usps_priority",
      "servicelevel_terms": "",
      "days": 1,
      "arrives_by": null,
      "duration_terms": "Delivery within 1, 2,\u00a0or 3 days\u00a0based on where your package started and where it\u2019s being sent.",
      "trackable": true,
      "insurance": false,
      "insurance_amount_local": "0.00",
      "insurance_currency_local": null,
      "insurance_amount": "0.00",
      "insurance_currency": null,
      "delivery_attempts": null,
      "outbound_endpoint": "door",
      "inbound_endpoint": "door",
      "messages": [
        
      ],
      "carrier_account": "e7170e72590f42268e48d15ae3dacc7d",
      "test": true
    },
    {
      "object_state": "VALID",
      "object_purpose": "PURCHASE",
      "object_created": "2016-11-03T23:26:57.814Z",
      "object_updated": "2016-11-03T23:26:57.814Z",
      "object_id": "718f76491fc04234ae05c0d1c4e69223",
      "object_owner": "[email protected]",
      "shipment": "6378f0777b2048149fbdf036316f3469",
      "available_shippo": false,
      "attributes": [
        
      ],
      "amount": "6.12",
      "currency": "USD",
      "amount_local": "6.12",
      "currency_local": "USD",
      "provider": "USPS",
      "provider_image_75": "https:\/\/shippo-static.s3.amazonaws.com\/providers\/75\/USPS.png",
      "provider_image_200": "https:\/\/shippo-static.s3.amazonaws.com\/providers\/200\/USPS.png",
      "servicelevel_name": "Parcel Select",
      "servicelevel_token": "usps_parcel_select",
      "servicelevel_terms": "",
      "days": 7,
      "arrives_by": null,
      "duration_terms": "Delivery in 2 to 8 days.",
      "trackable": true,
      "insurance": false,
      "insurance_amount_local": "0.00",
      "insurance_currency_local": null,
      "insurance_amount": "0.00",
      "insurance_currency": null,
      "delivery_attempts": null,
      "outbound_endpoint": "door",
      "inbound_endpoint": "door",
      "messages": [
        
      ],
      "carrier_account": "e7170e72590f42268e48d15ae3dacc7d",
      "test": true
    }
  ],
  "messages": [
    
  ],
  "metadata": "",
  "test": true
}

Rates!

I realize that this is just the node-client repo, and I posted cURL examples, but the same issue occurs with the Node Driver (what I am ultimately trying to use), and I didn't wanna let my HTTP client or poor async programming cloud the issue.

"FedEx: (820) NOTE: The destination state/province code has been changed." for shipping with no state/province

I have a wordpress+foxycart setup that gets quotes from goshippo. An address in france is giving this error on every request. There is no state/provice for this region. Customer supplied the following info:

[shipping_first_name] =>
[shipping_last_name] =>
[shipping_company] =>
[shipping_address1] =>
[shipping_address2] =>
[shipping_city] => Villiers-sur-Seine
[shipping_state] =>
[shipping_postal_code] => 77114
[shipping_country] => FR
[shipping_phone] => 

How do I correctly make this error message stop? Thank you!

No UPS Rates for some zipcodes

So far all the zip codes we've tested work, and we get the list of shipping rates, but we already have two customers who get no UPS options for these two zip codes (and I'm sure more will follow in coming days while we try and come up with a backup plan):

32812
80504

These ONLY respond with USPS rates (we only have USPS and UPS hooked up).

Oddly, when I log into our shippo account I can create an order to these zip codes and get UPS rates through the website, but the API returns none of those (when we only send the zip)

Fedex API live returns permission denied

I am doing like this:
shippo.transaction.create(transactionObj, (err, transaction) => { console.log(error); // -> undefined console.log(transaction); // -> { detail: "Permission denied" } })
It worked until a couple of weeks ago.

Address Creation Never Returns from a Promise

When calling the following code it appears to never return a promise. Create appears to be a promises but it never resolves...

Here is the code that I am using to duplicate the issue, replace with a correct shippo API key:

`let shippo = require('shippo');
shippo = shippo('****');

const createAddress = () => {
console.log(Address Creation Start);
const address = {
name: 'Chris',
street1: '602 Kai Dr',
city: 'Cedar Park',
state: 'TX',
email: '[email protected]',
zipCode: '78613'
};
address.validate = true;
address.async
let test = shippo.address.create;
console.log(test);
var address2 = shippo.address.create(address);
return address2
.then(result => {
console.log(Address Creation: ${JSON.stringify(result)});
if (result.object_state !== 'VALID') {
console.log(Error happened: ${result});
const error = {
statusCode: 400,
message: result.messages[0].text
};

    throw error;
  }

  console.log(`Success!`);
  return {isValid: true};
});

};

promiseAddress = () => {
console.log('Here now');
return createAddress()
.then(result => {
console.log(${JSON.stringify(result)});
});
};

promiseAddress();`

Bad carrier account in single call example

I'm in test mode and am trying to work through the example found here: https://goshippo.com/docs/single-call/

It's giving me the following error:
{type: "ShippoAPIError", message: "The data you sent was not accepted as valid", detail: {โ€ฆ}, path: "/transactions/?shipment=&carrier_account=b741b99f9โ€ฆ9b54272834bc478c&servicelevel_token=usps_priority", statusCode: 400}
detail:
carrier_account: ["Account with object_id b741b99f95e841639b54272834bc478c was not found."]
proto: Object
message: "The data you sent was not accepted as valid"
path: "/transactions/?shipment=&carrier_account=b741b99f95e841639b54272834bc478c&servicelevel_token=usps_priority"
statusCode: 400
type: "ShippoAPIError"
proto: Object

Am I meant to swap out the carrier account ID with one of my own?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.