What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to establish the communication between Shopify API and app?

How to establish the communication between Shopify API and app?

vincedenis
Shopify Partner
6 0 0

Hi I am new in Shopify app development.

I am trying to create an app that able to calculate shipping price for our store because our shipping criteria is quite specific and currently I haven't found any app that meet our criteria.

 

I had a read at:

https://shopify.dev/docs/api/admin-rest/2023-10/resources/carrierservice

but it doesn't explain how Shopify will contact the app to obtain the shipping price

 

I am still unclear of what events will trigger the communication to the app, as in how to establish the condition so Shopify will make an API request to our app to retrieve the shipping price.

If would really appreciate if someone could shed a light to me or pointing out a documentation that explain how to establish the communication.

 

Replies 2 (2)

Liam
Community Manager
3108 344 895

Hi Vincedenis,

 

When you create a new CarrierService, and specify the callback URL of your app, Shopify will send a POST request to this callback URL every time a customer is at the checkout page and needs to see shipping rates.

 

The POST request will contain information about the origin, destination, and the package (like weight, value, etc.). Your app needs to respond to this request with a list of shipping rates that you want to offer to the customer.

 

Hope this helps!

Liam | Developer Advocate @ 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

vincedenis
Shopify Partner
6 0 0

Hi Liam, thanks for your reply.
So I have added the scope through the shopify.app.toml, but how can I add the new CarrierService to specify the callbackURL?
I am basically trying to create my own shipping rate calculation in the app