OpenAPI: Using APIs to charge a non-primary carrier account

Overview:

Some users have multiple accounts for the same carrier configured in their ShipStation account. When there are multiple accounts, one account is chosen as the "primary" account which will be billed by default unless otherwise specified. This KB article demonstrates how to leverage the ShipStation OpenAPI to charge non-primary accounts when creating shipment labels.

This article assumes the user already has basic knowledge on how to setup API credentials and make API calls. The full OpenAPI documentation is located here.

1. Finding the account "shippingProviderId"

First, find the "shippingProviderId" associated with the carrier account you wish to bill. The shippingProviderId is the unique key that ShipStation assigns to your carrier account.

This can be done by calling the "List Carriers" endpoint.

GET https://ssapi.shipstation.com/carriers

This call will return an array of carrier accounts with information including the shippingProviderId field that will be needed later.

[
{
"name": "UPS",
"code": "ups",
"accountNumber": "111111",
"requiresFundedAccount": false,
"balance": 0,
"nickname": " UPS Primary",
"shippingProviderId": 123456,
"primary": true
},
{
"name": "UPS",
"code": "ups",
"accountNumber": "222222",
"requiresFundedAccount": false,
"balance": 0,
"nickname": "UPS 2",
"shippingProviderId": 123123,
"primary": false
}
]

2. Creating the AdvancedOptions object

The AdvancedOptions object is used in both the Shipment and Order object. The two fields that need to be specified to charge a non-primary account are:

"billToParty":"my_other_account"
"billToMyOtherAccount": your_shippingProviderId

Example advancedOptions object:

"advancedOptions": {
"nonMachinable": false,
"saturdayDelivery": false,
"containsAlcohol": false,
"mergedOrSplit": false,
"mergedIds": [],
"parentId": null,
"storeId": 12345,
"customField1": null,
"customField2": null,
"customField3": null,
"source": null,
"billToParty": "my_other_account",
"billToAccount": null,
"billToPostalCode": null,
"billToCountryCode": "US",
"billToMyOtherAccount": 123123
}

3. Creating the label

You can create a label using either the "Create Label for Order" or "Create Label" endpoint

Option 1: Create Label for Order

If you want to create a label for a specific order, you make a POST request to the /orders/createlabelfororder endpoint.

You can follow the example provided in the the API documentation here. But instead of "advancedOptions":null, advancedOptions should be set to the object created in Step 2.

When you send the request a label will be created, and the account specified in the billToMyOtherAccount field will be charged.

Option 2: Create Label

If you want to create a label that is independent of any order, you make a POST request to the /shipments/createlabel endpoint.

You can follow the example provided in the the API documentation here. But instead of "advancedOptions":null, advancedOptions should be set to the object created in Step 2.

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request