CarrierService Not Posting to our Callback URL

PacoT
New Member
1 0 0
I have created a carrier service using api call carrier_services.json its created successfully with ID 49373053080 but for some reason callback url that we supplied is not being called when we access checkout from frontend we have logging enabled for getting shopify data but seems like shopify never call it when customer checkout .................
 
We've been faced with a challenge or so it seems to integrate CarrierService for a Shopify Site. We have managed to create a carrier via the Shopify API via /admin/api/2021-01/carrier_services.json.
 
With all the correct details and parameters. We have also got shop locale and all necessary access at read and write level on our private app not to mention we have the right account plan. We have also made sure our callback works with a simple print_r of data that gets posted to this callback_url. However, it appears upon checkout (on the shipping page) Shopify doesn't seem to ping our callback_url to get the shipping rate info.
 
If anyone could be so kind to help us or point us into the right direction that would be massively appreciated.
 
 
 Array ( [carrier_services] => Array ( [0] => Array ( [id] => 57830703269 [name] => Custom US Shipping Rate [active] => 1 [service_discovery] => 1 [carrier_service_type] => api [admin_graphql_api_id] => gid://shopify/DeliveryCarrierService/57830703269 [format] => json [callback_url] => https://sofaworkshop.ddns.net/inc/api_shiping_cost.php ) ) ) 
0 Likes
GrahamS
Shopify Staff
Shopify Staff
83 16 16

Hey @PacoT ,

I'm going to ask you to contact Partner Support directly for this one - without having an authenticated interaction, we can't dig too deeply here to see if there are any internal issues with the carrier service or server operations. Once you've contacted Partner Support and generated a ticket, we should be able to dive in and see what we can find.

Graham S | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
FlickerLeap
New Member
2 0 0

Hey,

I just checked the endpoint you referenced which is returning the following, I think the issue you having is the JSON is coming back miss formed because of the PHP warning, clear the warning and it should work

<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/var/www/html/sofaworkshop.ddns.net/inc/api_shiping_cost.php</b>
on line <b>19</b><br />
{"rates":[{"service_name":"
Overnight","service_code":"ETON","total_price":10,"currency":"USD","min_delivery_date":"2021-06-23
04:18:37 +0800","max_delivery_date":"2021-06-24 04:18:37
+0800"},{"service_name":"
Regular","service_code":"ETREG","total_price":20,"currency":"USD","min_delivery_date":"2021-06-25
04:18:37 +0800","max_delivery_date":"2021-06-29 04:18:37 +0800"}]}

 

I formatted the JSON which all looks ok except for the amount which needs to be a string and I presume maybe a greater number 10 = 10 cents,  and 20 = 20 cents,  maybe make it a higher number to test

{
    "rates": [
        {
            "service_name":"Overnight",
            "service_code":"ETON",
            "total_price":10,
            "currency":"USD",
            "min_delivery_date":"2021-06-2304:18:37 +0800",
            "max_delivery_date":"2021-06-24 04:18:37+0800"
        },
        {
            "service_name":"Regular",
            "service_code":"ETREG",
            "total_price":20,
            "currency":"USD",
            "min_delivery_date":"2021-06-2504:18:37 +0800",
            "max_delivery_date":"2021-06-29 04:18:37 +0800"
        }
    ]
}

 

Also keep in mind that Shopify will make a post request to this URL, don't know if you expecting a GET, I tested both and I don't think that's the issue because your endpoint accepts both it seems.

Summary

  1. Fix the warning
  2. Change the amount to string
  3. Possibly higher than 10 or 20 cents (maybe)
0 Likes