Calculate the shipping costs from a custom REST service

Highlighted
New Member
3 0 0

Hello all,

I have developed a REST service to calculate the shipping costs on my own business rules.

To do that, I have taken the Advanced Shopify plan but this feature dosn't work, below the message display at the checkout step :

"Your cart has been updated and the items you added can’t be shipped to your address. Remove the items to complete your order."

 

In the Settings > Shipping and delivery > General shipping, I have created a shipping test area with my custum service.

 

Below, the GET result from the carrier service configuration ('/admin/carrier_services.json') :

{
    "carrier_services": [
        {
            "id"123456789,
            "name""xxxxxx",
            "active"true,
            "service_discovery"true,
            "carrier_service_type""api",
            "format""json",
        }
    ]
}

And below the POST body sent by the service ('https://script.google.com/macros/s/AKfycbzx-syqzsZmJyt-GR4XeNitpUUT_96PQZOPsZTh00LgCVRuw6U/exec') :

{
  "rate": {
    "origin": {
      "country""CA",
      "postal_code""K2P1L4",
      "province""ON",
      "city""Ottawa",
      "name"null,
      "address1""150 Elgin St.",
      "address2""",
      "address3"null,
      "phone""16135551212",
      "fax"null,
      "email"null,
      "address_type"null,
      "company_name""Jamie D's Emporium"
    },
    "destination": {
      "country""CA",
      "postal_code""K1M1M4",
      "province""ON",
      "city""Ottawa",
      "name""Bob Norman",
      "address1""24 Sussex Dr.",
      "address2""",
      "address3"null,
      "phone"null,
      "fax"null,
      "email"null,
      "address_type"null,
      "company_name"null
    },
    "items": [{
      "name""Novacel 4228REF",
      "sku""",
      "quantity"10,
      "grams"32000,
      "price"450,
      "vendor""Novacel",
      "requires_shipping"true,
      "taxable"true,
      "fulfillment_service""manual",
      "properties"null,
      "product_id"48447225880,
      "variant_id"258644705304
    }],
    "currency""EUR",
    "locale""en"
  }
}
And the result :
{
    "rates": [
        {
            "service_name""canadapost-overnight",
            "service_code""ON",
            "total_price"1295,
            "description""This is the fastest option by far",
            "currency""CAD",
            "min_delivery_date""2013-04-12 14:48:45 -0400",
            "max_delivery_date""2013-04-12 14:48:45 -0400"
        },
        {
            "service_name""fedex-2dayground",
            "service_code""2D",
            "total_price"2934,
            "currency""USD",
            "min_delivery_date""2013-04-12 14:48:45 -0400",
            "max_delivery_date""2013-04-12 14:48:45 -0400"
        },
        {
            "service_name""fedex-priorityovernight",
            "service_code""1D",
            "total_price"3587,
            "currency""USD",
            "min_delivery_date""2013-04-12 14:48:45 -0400",
            "max_delivery_date""2013-04-12 14:48:45 -0400"
        }
    ]
}
 
For test, I have implemented the example  given by the documentation but it doesn't work.
 
Thanks for your help.
0 Likes
Highlighted
Shopify Staff
Shopify Staff
582 70 127

Hey @Tsrnov,

Can you provide the checkout_token from a checkout URL where you saw this error? I can use this to investigate further.

https://{{shop_name}}.myshopify.com/{{shop_id}}/checkouts/{{checkout_token}}

 

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Highlighted
New Member
3 0 0

Hello JB,

We have specially taken the advanced plan to use this feature.

This issue is a blocking point for us, to open the shop.

Did you check the checkout ?

Thanks you for help.

0 Likes