Step 3. Send a response with shipping options

Once your app has shipping rates, it must pass them as shipping options back to Ecwid. Ecwid API expects a JSON object with the shipping option name, description, and shipping rate.

Code example for the response JSON

The following response will display 4 shipping options to the customer: 2 delivery and 2 pickup options.

{
    "shippingOptions": [
      {
        "title": "SuperMail First Class",
        "rate": 10.31,
        "transitDays": "1",
        "description": "Courier will come tomorrow between 10AM-12PM.",
        "titleTranslated": {
          "en": "SuperMail First Class",
          "it": "SuperMail di prima classe"
        },
        "descriptionTranslated": {
          "fr": "Courier will come tomorrow between 10AM-12PM.",
          "it": "Il corriere arriverà domani tra le 10:00 e le 12:00."
        }
      }, 
      {
        "title": "SuperMail Regular Delivery",
        "rate": 5.01,
        "transitDays": "5",
        "description": "This method provides tracking number.",
        "fulfilmentType": "SHIPPING",
      },
      {
        "title": "Pick up at store #1",
        "rate": 0,
        "transitDays": "1",
        "description": "Pick you order at 210, 5th West street, New York",
        "fulfilmentType": "PICKUP",
        "scheduled": true,
        "businessHours":"{\"THU\":[[\"09:00\",\"18:00\"]],\"TUE\":[[\"09:00\",\"18:00\"]],\"WED\":[[\"09:00\",\"18:00\"]],\"FRI\":[[\"09:00\",\"18:00\"]],\"MON\":[[\"09:00\",\"18:00\"]]}",
        "fulfillmentTimeInMinutes": 60,
        "blackoutDates": "{blackoutDates:[{intervalStart:\"June 23, 2022, 4:00:00 AM\",intervalEnd:\"June 25, 2022, 12:12:10 PM\",repeatAnnually:true}]}"
      },
      {
        "title": "Pick up at store #2",
        "rate": 2,
        "transitDays": "2",
        "description": "Pick you order at 88, Town street, Chicago",
        "fulfilmentType": "PICKUP",
        "scheduled": false
      },
      {
        "title": "Local delivery Chicago",
        "rate": 5,
        "transitDays": "0",
        "description": "2 hours delivery",
        "fulfilmentType": "DELIVERY",
        "scheduled": false
      }                   
    ] 
}

Response JSON

Ecwid API expects a JSON object with the following fields:

Name
Type
Description

title

string

Shipping method name visible to customers at the checkout. Required

rate

number

Shipping rate added to the order total cost. Required

transitDays

string

Estimated delivery time visible to customers at the checkout. Formats accepted: empty "", number "5", several days estimate "4-9". You need to pass both transitDays and description. One of them will be displayed to customers depending on store's internal settings. Required

description

string

Shipping method description in text format, for example, "Estimated delivery time is 3-5 days". You need to pass both transitDays and description. One of them will be displayed to customers depending on store's internal settings. Required

titleTranslated

Available translations for the shipping method name.

descriptionTranslated

Available translations for the shipping method description.

fulfilmentType

string

Fulfillment type. One of:

PICKUP for in-store pickup methods. Only visible to customers if they chose I'll pick it up myself option at the checkout.

DELIVERY for local delivery methods. Only visible to customers if they chose Ship to address option at the checkout.

SHIPPING for everything else (default). Only visible to customers if they chose Ship to address option at the checkout.

scheduled

boolean

Define if the shipping option should require the datepicker (similar to the or "Ask for Pickup Date and Time at Checkout" setting) Set true to enable. Ignored if fulfilmentType has value "SHIPPING".

businessHours

Should be passed if "scheduled": true. Available and scheduled times to pickup orders.

fulfillmentTimeInMinutes

number

Amount of time (in minutes) required for store to prepare pickup or to deliver an order (Order Fulfillment Time setting)

blackoutDates

Dates when the store doesn’t work, so customers can't choose these dates for local delivery. Each period of dates is a JSON object.

businessHours

Limit available hours when customers can pickup their orders in your store.

Format: String made from a JSON object with one or several weekdays, each having an array of time ranges (also in the array format).

Quotes must be escaped

Code example:

"{\"MON\":[[\"07:00\",\"19:00\"]], \"TUE\":[[\"07:00\",\"13:00\"],[\"13:30\",\"19:00\"]]}"

blackoutDates

Field
Type
Description

fromDate

string

Starting date of the period, e.g. 2022-04-28.

toDate

string

The end date of the period, e.g. 2022-04-30.

repeatedAnnually

boolean

Specifies whether the period repeats in the following years or not.

translations

Object with text field translations in the "lang": "text" format, where the "lang" is an ISO 639-1 language code. For example:

{
    "en": "Sample text",
    "nl": "Voorbeeldtekst"
}

Translations are available for all active store languages. Only the default language translations are returned if no other translations are provided for the field. Find active store languages with GET /profile request > languages > enabledLanguages.

Last updated

Was this helpful?