Issues with Shopify not reading CarrierService Responce to request

Solved
Highlighted
Tourist
5 1 1

Hi, Shopify community,

I'm working on setting up an API carrier service that would retrieve the rates from a local server.

The Shopify store is a developer store, and the Carrier is registered there successfully with the right IP address.

However, when I create a test order and go to checkout, I don't see my rates there.

I can see the carrier in Shopify admin settings - no services for that carrier thou.

Using Postman, I see that the JSON response to the POST request to the URL (http://108.68.58.107:5000/api/rates/) is correct.

My server also sees the POST request when Shopify submits it, however, it tells me that 

"the application completed without reading the entire request body". Any ideas why Shopify is not retrieving the response to the post?

 

Here is the Carrier service JSON response from Shopify when getting the carriers:

{
"carrier_services": [
{
"id": 29639147599,
"name": "Test Shipping Integration",
"active": true,
"service_discovery": true,
"carrier_service_type": "api",
"format": "json",
"callback_url": "http:\/\/108.68.58.107:5000\/api\/rates\/"
},
 
Using Postman, when I send a post request to http://108.68.58.107:5000/api/rates/ I get the following response:
 Body:
{
"rates": [
{
"service_name": "First Rate Test",
"service_code": "VA1",
"total_price": "1000",
"description": "First Rate Test",
"currency": "USD",
"min_delivery_date": "2019-08-03 14:48:45 -0400",
"max_delivery_date": "2019-08-02 14:48:45 -0400"
},
{
"service_name": "Expedite Service",
"service_code": "VAE",
"total_price": "2000",
"description": "Expedite Service",
"currency": "USD",
"min_delivery_date": "2019-08-02 14:48:45 -0400",
"max_delivery_date": "2019-08-01 14:48:45 -0400"
}
]
}
 
Postman says that header has content-type as application/json; charset=utf-8
 
App Info: .Net Core 2.2
Web Server: Microsoft.AspNetCore.Server.Kestrel
Server Response when Shopify submits a request:
Connection id "0HLOKBDRID6KP", Request id "0HLOKBDRID6KP:00000001": the application completed without reading the entire request body.
 
 

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1129 82 173

This is an accepted solution.

Hey @vminasyan ,

 

When checking our logs here, it looks like the response to our request for rates is a 307 redirect which is interpreted as a failure. Are you able to look into why that may be happening? 

 

If you're able to solve that part of the issue and still aren't seeing rates, feel free to post back here to let me know and I can take another look.

0 Likes
Highlighted
Tourist
5 1 1

This is an accepted solution.

Hi Josh,

That was it!

I didn't see that my WebServer is redirecting all traffic to https (while not having the right certs for it) - once I fixed that, the rates started appearing.

Appreciate your help!

0 Likes
Highlighted
Shopify Partner
9 0 0

I am having simular issues.

Shopify Callback URL is working and the web API is returning the following json to Shopify

[
{
"service_name": "overnight",
"service_code": "WI",
"total_price": "123",
"description": "This is a test",
"currency": "USD",
"phone_required": "9102124523",
"min_delivery_date": "2020-07-12 14:48:45 -0400",
"max_delivery_date": "2020-07-12 23:48:45 -0400"
}
]

 

But when in Shopify the user interface is showing the following message after I click on the Continue to Shipping button

This order can’t be shipped to your location. Contact the store for more information.

What am I doing wrong?

0 Likes