How shipping method works
Checkout flow for shipping apps
1. User configures app settings in settings tab
After the installation, user would need a page where they can configure it: provide their account details, set up dimensions, etc. We recommend using Native apps feature to provide this functionality. To manage and store those settings, see the Merchant app settings section.
2. Ecwid sends order data to app request URL
The request to your app URL can be triggered by a customer in storefront or by an API request to order details calculation endpoint.
To show new shipping methods in storefront, Ecwid will send a POST request to your endpoint with order details: items that require shipping and have shipping set as global or global + fixed rate per item, customer address, merchant app settings, etc. That endpoint must respond to the request with the shipping rates for this configuration.
In the case of an API request for calculating order details, the products and cart information itself can be different from what the store has:
for example, some other application can create a custom storefront where it requests order calculation with items that are not present in the store. For these cases, your application should also provide correct discount calculations for the amount of cart information available.
3. Application returns the rates in a specific format
Ecwid will expect a response from your service within 10 second interval to display additional shipping methods for customers. In the response, provide shipping method name, rate and estimated delivery time. See the response format in the Request and response section.
4. Ecwid displays the rates at checkout
Based on the response from your app, Ecwid will display the shipping methods for customers at the checkout. Customer can select them just like any other shipping method in that Ecwid store and it will be shown in the order details. Shipping methods from the application will be added to any currently enabled shipping methods a store has enabled.
Custom shipping FAQ
Q: What happens, if my URL responds with an error?
In case if your app responds with an error or in an incorrect format, then the shipping methods from your app will not be shown to customer at checkout stage. If your store has applicable shipping methods set up using the default means of creating shipping methods in Ecwid, then they will be shown to customer.
Q: Does Ecwid cache the requests in any way?
Yes. Ecwid will not make a request to your URL on these conditions:
- previous request happened less than 5 minutes ago
- request details are exactly the same as in previous request
In other cases, Ecwid will make a new request to your endpoint.
For example, a new product was added to cart, shipping/payment method was changed, customer address was changed, etc.
Any event that changes the order details will reset the cache and Ecwid will make a new request to your endpoint.