Carrier Service API is calling my shipping rate endpoint but not getting my response

Azwar_Khalid
Shopify Partner
4 0 1

Hi, 

I have been debugging this but can't find anything in the API docs that address such a problem.  I am creating a shipping service using the carrier shipping API.  I am able to install the app and authenticate successfully.  Also able to register a carrier shipping service.  Exactly as detailed here: http://docs.shopify.com/api/carrierservice ;

I also confirmed that when I go to checkout the Shopify is making a call to my call back url http://178.62.16.155/shipping-rates.php with the shipping request.  I have set that page to respond with: 

 

{ "rates": [

{"service_name": "i Parcel FAST",

"service_code": "i_parcel_fast",

"total_price": "55",

"currency": "CAD"}

] }

 

However, I get no errors or any notification on the store side.  Can you advise on what could be wrong here? 

 

 

 

 

HunkyBill
Shopify Expert
4374 36 468

You are not providing any dates. Without dates Shopify cannot calculate the business days to delivery. Hence you are not returning enough information. For testing purposes, you will need to try a LOT of dates to satisfy your needs. Shopify has all sorts of undocumented quirks when it comes to processing your dates. Things like weekends. Make sure you provide good minimum and maximum dates and all will likely work. 

I fought this API for some time, and getting it in shape was not easy...

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Azwar_Khalid
Shopify Partner
4 0 1

Thanks for the tip Bill.  I already had the shipping dates initially and it still wasn't working.  I just put it back in: http://178.62.16.155/shipping-rates.php

 

{"rates": [{"service_name": "Regular","service_code": "regular","total_price": "35","currency": "CAD","min_delivery_date": "2014-09-21 14:48:45 -0400","max_delivery_date": "2014-09-24 14:48:45 -0400"},{"service_name": "Fast","service_code": "fast","total_price": "55","currency": "CAD","min_delivery_date": "2014-09-10 14:48:45 -0400","max_delivery_date": "2014-09-14 14:48:45 -0400"}]}

 

Also for the record this is my php code:

$dataArray = array(

        array("service_name"=>"Regular","service_code"=>"regular", "total_price"=>"35", "currency"=>"CAD","min_delivery_date"=>"2014-09-21 14:48:45 -0400","max_delivery_date"=>"2014-09-24 14:48:45 -0400" ),

        array("service_name"=>"Fast","service_code"=>"fast", "total_price"=>"55", "currency"=>"CAD","min_delivery_date"=>"2014-09-10 14:48:45 -0400","max_delivery_date"=>"2014-09-14 14:48:45 -0400"  )

      );

$resp = array('rates' => $dataArray);

header('Content-Type: application/json');

echo json_encode($resp);

0 Likes
MrPunkin
Explorer
84 0 28

The problem I had with mine, originally, was that our app runs on HTTPS but the CarrierService rate request has to happen over HTTP. Make sure that your URL for the carrier service is HTTP and that your server can respond via HTTP.

Ran_Erlich
Shopify Partner
4 0 1

Hi 

did you manage to solve the problem?

I am struggling with the same problem myself

thanks

Ran

URLify-me
Excursionist
17 0 2

I have the same problem, is HTTP still needed instead of HTTPS? We are in 2021.

URLify.me | Creating E-Commerce Stores
0 Likes
URLify-me
Excursionist
17 0 2

I've got my CarrierService API to work, the solution is here. HTTPS was not the problem, it is working with HTTPS.

URLify.me | Creating E-Commerce Stores
0 Likes