Webhooks: shipping

You can use the shipping rates webhook when you want to handle shipping rates calculation by yourself. Snipcart will call your application at the URL specified in your dashboard.

In your dashboard go to Store configurations → Shipping → Webhooks and enter the required endpoint information.

Snipcart will make an HTTP POST request to the URL specified. The request body will contain all the current order details.


Method POST

Content-Type application/json


  "eventName": "shippingrates.fetch",
  "mode": "Live",
  "createdOn": "2015-02-21T14:58:02.6738454Z",
  "content": {
    "token": "22808196-0eff-4a6e-b136-3e4d628b3cf5",
    "creationDate": "2015-02-21T14:58:02.6738454Z",
    "modificationDate": "2015-02-21T14:58:02.6738454Z",
    "status": "Processed",
    "currency": "USD",
    "lang": "en",
    "paymentMethod": "CreditCard",
    "email": "customer@snipcart.com",
    "cardHolderName": "Nicolas Cage",
    "billingAddressName": "Nicolas Cage",
    "billingAddressCompanyName": "Company name",
    "billingAddressAddress1": "888 The street",
    "billingAddressAddress2": "",
    "billingAddressCity": "Quebec",
    "billingAddressCountry": "CA",
    "billingAddressProvince": "QC",
    "billingAddressPostalCode": "G1G 1G1",
    "billingAddressPhone": "(888) 888-8888",
    "shippingAddressName": "Nicolas Cage",
    "shippingAddressCompanyName": "Company name",
    "shippingAddressAddress1": "888 The street",
    "shippingAddressAddress2": "",
    "shippingAddressCity": "Quebec",
    "shippingAddressCountry": "CA",
    "shippingAddressProvince": "QC",
    "shippingAddressPostalCode": "G1G 1G1",
    "shippingAddressPhone": "(888) 888-8888",
    "shippingAddressSameAsBilling": true,
    "finalGrandTotal": 310.00,
    "shippingAddressComplete": true,
    "creditCardLast4Digits": "4242",
    "shippingFees": 10.00,
    "shippingMethod": "Livraison",
    "items": [{
      "uniqueId": "eb4c9dae-e725-4dad-b7ae-a5e48097c831",
      "token": "22808196-0eff-4a6e-b136-3e4d628b3cf5",
      "id": "1",
      "name": "Movie",
      "price": 300.00,
      "originalPrice": 300.00,
      "quantity": 1,
      "url": "https://snipcart.com",
      "weight": 10.00,
      "description": "Something",
      "image": "http://placecage.com/50/50",
      "customFieldsJson": "[]",
      "stackable": true,
      "maxQuantity": null,
      "totalPrice": 300.0000,
      "totalWeight": 10.00,
      "shippable": true,
    "subtotal": 610.0000,
    "totalWeight": 20.00,
    "discounts": [],
    "willBePaidLater": false


Snipcart expects to receive a JSON object containing an array of shipping rates.


Response status code must be 2XX to indicate that the request has been handled successfully.

Required HTTP headers

Key Value
Content-Type application/json


Name Type Description Required
cost decimal Shipping method's price. true
description string Name or description of the shipping method. true
guaranteedDaysToDelivery int Estimated time for delivery in days. false
userDefinedId string Internal ID of shipping method, can be useful when using shipping fulfillment solutions. false

Response example

    "rates": [{
        "cost": 10,
        "description": "10$ shipping",
        "userDefinedId": "shipping_10",
    }, {
        "cost": 20,
        "description": "20$ shipping",
        "guaranteedDaysToDelivery": 5,
        "userDefinedId": "shipping_20",
        "cost": 30,
        "description": "30$ shipping",
        "userDefinedId": "shipping_30"

Quick word on the userDefinedId property, it can be especially useful when your Shipping webhook integrates with a fulfillment solution, sometimes you need to carry the unique shipping rate ID through the whole ordering process. When your rates contain this field, the property shippingRateUserDefineId property will be set on the Order, therefore available in Webhook requests and API calls.


If you want Snipcart to show an error message to your customers, you can do so by returning us a 2XX status code with the following JSON object.

  "errors": [{
    "key": "invalid_postal_code",
    "message": "The postal code is invalid."

Was this article helpful?