CarrierService

Shoplazza supports the integration of third-party services related to shipping cost calculation to provide merchants with a more diverse range of shipping plans and calculations. You simply need to register a shipping plan and provide a Callback URL, and when an order is placed in the store, the third-party service will be called to calculate the shipping cost.

Requirements for accessing the CarrierService resource

To access the CarrierService resource, add the write_order permission to your app's requested scopes. For more information, see scope detail.

Providing shipping rates to Shoplazza

When adding a carrier service to a store, you need to provide a POST endpoint rooted in the callback_url property where Shoplazza can retrieve applicable shipping rates. The callback URL should be a public endpoint that expects these requests from Shoplazza.

A sample Shoplazza request for shipping rates:

POST: you callback_url

the json of shipping rate request sent to a carrier service

{
    "line_items": [
        {
            "product_id": "string",
            "variant_id": "string",
            "quantity": 0,
            "length": "string",
            "width": "string",
            "height": "string",
            "dimension_unit": "string",
            "weight": "string",
            "weight_unit": "string"
        }
    ],
    "currency_code": "string",
    "from_address": {
        "country": "string",
        "country_code": "string",
        "province": "string",
        "province_code": "string",
        "city": "string",
        "address": "string",
        "address1": "string",
        "company": "string",
        "zip": "string"
    },
    "to_address": {
        "country": "string",
        "country_code": "string",
        "province": "string",
        "province_code": "string",
        "city": "string",
        "address": "string",
        "address1": "string",
        "company": "string",
        "zip": "string"
    }
}
FieldTypeDescription
line_itemsrequired
product_idstringrequired
variant_idstringrequired
variant_titlestringrequired
quantitystringrequiredNumber of Items
lengthstringrequired
widthstringrequired
heightstringrequired
dimension_unitstringrequiredunits of measurement
weightstringrequired
weight_unitstringrequired
currency_codestringrequiredCurrent settlement currency
from_addressrequired
countrystring
country_codestringrequired
provincestring
province_codestringrequired
citystring
addressstring
address1string
companystring
zipstringrequiredPostal Code
to_addressrequired
countrystring
country_codestringrequired
provincestring
province_codestringrequired
citystring
addressstring
address1string
companystring
zipstringrequiredPostal Code

**Example

{
  "line_items": [
    {
      "product_id": "01600c6b-7f9b-4740-8b29-82ee83ee0456",
      "variant_id": "9fc41b4e-cf4d-463f-ad18-0b18943b9402",
      "quantity": 1,
      "length": "1.00",
      "width": "1.00",
      "height": "1.00",
      "dimension_unit": "in",
      "weight": "2.00",
      "weight_unit": "kg"
    }
  ],
  "currency_code": "CAD",
  "from_address": {
    "country_code": "CA",
    "province_code": "BC",
    "city": "Coquitlam",
    "zip": "V3C3R9"
  },
  "to_address": {
    "country_code": "CA",
    "province_code": "BC",
    "city": "Coquitlam",
    "zip": "V3C3R9"
  }
}

Response

When Shoplazza requests shipping rates using your callback URL, the response object rates must be a JSON array of objects with the following fields. Required fields must be included in the response for the carrier service integration to work properly.

Here is a example:

{
  "service_name": "string",
  "description": "string",
  "service_code": "string",
  "currency": "string",
  "total_price": "string"
}
FieldDescription
service_nameThe name of the rate, which customers see at checkout.
descriptionA description of the rate, which customers see at checkout.
service_codeA unique code associated with the rate.
currencyThe currency of the shipping rate.
total_priceThe total price expressed in subunits.If the currency doesn't use subunits, then the value must be multiplied by 100.For example: "total_price": 500 for 5.00 CAD, "total_price": 100000 for 1000 JPY.

Response Timeouts

The read timeout for rate requests are dynamic, based on the number of requests per minute (RPM). These limits are applied to each shop-app pair. The timeout values are as follows.

RPM RangeTimeout
Under 150010s
1500 to 30005s
Over 30003s

These values are upper limits and should not be interpretted as a goal to develop towards. Shoplazza is constantly evaluating the performance of the platform and working towards improving resilience as well as app capabilities. As such, these numbers may be adjusted outside of our normal versioning timelines.