I Need To Know How To Get Shipping Rate Request That Contains Shipping Address

yazidelbadri93
Shopify Partner
8 0 0

Hello,

 

I created a custom app in Shopify partners with node js, this is the steps I did:

 

1- create a carrier service with callback_url as a public Url

2- in the URL endpoint, it's a post as this doc says https://shopify.dev/api/admin-rest/2022-04/resources/carrierservice#top..

3- in this Post now I'm returning the rates to Shopify like this 

{ "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" } ] }
Copy

 

I get the total_price for each shipping method from an external service calling it by API. 

 

the problem I have is that now the external service needs a shipping address and quantity to give me back the rates. for now, I'm using a hardcoded shipping address and quantity, what I want is to have the real shipping address and quantity.

 

the documentation says that Shopify will provide that to me before I return the rates, but I don't know how to get it. I tried to see in the req. body but there is nothing.

 

can you any help, please

 

Regards.

 

Yazid.

Replies 2 (2)

KB77
Shopify Staff
59 6 11

Hi @yazidelbadri93 

While custom app development is outside of our team's scope of support, I would recommend taking a look at this guide on creating carrier fulfilment app for more details.

I would also be recommended to review the scopes you have made available to your app to ensure write_fullfillments has been included.

KB77 | 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

yazidelbadri93
Shopify Partner
8 0 0

Thanks for your reply, i got the solution my self, is to add app.use(express()) in my code to get the correct request body.