It's pretty easy to implement if you're a developer.
The API documentation is here:
With that said, I'd highly recommend looking at this next week as carrierService API is having issues this week and the API is not currently reliable. So you'll run into problems, which normally would not exist.
See this incident report:
You can follow along here with when this will be resolved:
I personally use AWS Lambda using serverless.com framework for my code. The good thing about this, is if you implement it this way, you should be under lambda rate limit in the free tier, so it won't cost you any money to run. I didn't know this when I implemented it myself, but I haven't paid in 2+ years.
Do I need to call some API to get the order data or I need to do something else? Btw can you see my code here I'm actually stuck at getting the order data because I finally realize the data that I get was order that had been paid. I'm creating private app.
Here the url: "https://github.com/MirFaith/Ondemand_Rate"
You need to host your code on your own servers.
Then you use this API request to point shopify to your CarrierService Endpoint URL
Then you need to enable your new shipping option in your stores shipping methods.
Then when a customer is checking out and Shopify is attempting to calculate the shipping price, shopify will send over the order data to your CarrierService Endpoint URL, and you need to return shipping rates for that order.
Does that make sense?
Requirements for accessing the CarrierService resource
To access the CarrierService resource, add the
write_shipping permission to your app's requested scopes. For more information, see API access scopes.
The store installing your carrier service must also meet one of the following requirements:
You're gonna have to do some reading yourself man, i can't be your brain. I told you, you need to enable it after registering it in the shipping settings for your store.
As mentioned Mir, carrierService is having issues currently.
I believe they're mostly worked out, but bugs you may be experiencing may be a problem with Shopify currently and not your fault. As mentioned, you can follow along here:
Additionally with carrierServices, results will be cached. So for Customer A, they get a carrierService rate, and you change the code, they will not get a new rate. It will be cached for that customer.
There are two ways to avoid this:
1. Change the contents of the cart. That will get a new rate from your server
2. Delete & re-add your carrierService API endpoint. This will also remove the cache.