2.2.8.2.Specific shipping method request
There are two types op specific shipping method request, one using a full JSON request. This request contains all customer and cart data that can be used to receive the specific allowed shipping methods.
An example of an specific shipping method request can be:
https://www.store.com/index.php?identifier=shipping
{ "currency":"EUR", "amount":2000, "countries":[ "NL", "ES" ], "customer":{ "locale":"nl_NL", "ip_address":"127.0.0.1", "forwarded_ip":"127.0.0.1", "first_name":"Jan", "last_name":"Modaal", "address1":"Kraanspoor", "address2":"", "house_number":"39", "zip_code":"1032 SC", "city":"Amsterdam", "state":"", "country":"NL", "phone":"0208500500", "email":"test@test.nl" }, "customer_delivery":{ "locale":"nl_NL", "ip_address":"127.0.0.1", "forwarded_ip":"127.0.0.1", "first_name":"Jan", "last_name":"Modaal", "address1":"Kraanspoor", "address2":"", "house_number":"39", "zip_code":"1032 SC", "city":"Amsterdam", "state":"", "country":"NL", "phone":"0208500500", "email":"test@test.nl" }, "shopping_cart":{ "items":[ { "name":"Test", "description":"", "unit_price":"10", "quantity":"2", "merchant_item_id":"test123", "tax_table_selector":"BTW0", "weight":{ "unit":"KB", "value":"20" } }, { "name":"Test2", "description":"", "unit_price":"10", "quantity":"2", "merchant_item_id":"test1235667", "tax_table_selector":"BTW0", "weight":{ "unit":"KB", "value":"20" } } ] } }
Next to the request above, that will be processed first, there will be a second request if the request above does not return any shipping methods.
The second request will POST data like:
name
|
value
|
---|---|
amount | amount in EUR |
countries | string in format like: [“NL”, “DE”, “ES” …] |
currency | EUR |
items_count | product count in cart |
weight | double |
weight_unit | Example: kb, lb |
zipcode | 1033 |
Responses to both type’s of shipping method request should be like:
Response
[ { "id":"flatrate", "type":"flat_rate_shipping", "provider":"flatrate", "name":"Fixed", "price":"5.00", "tax":{ "name":"Taxable Goods", "id":"2", "rate":"21.0000" } }, { "id":"freeshipping", "type":"flat_rate_shipping", "provider":"freeshipping", "name":"Free", "price":0, "tax":{ "name":"Taxable Goods", "id":"2", "rate":"21.0000" } }, { "id":"PostNL", "name":"Post NL - Pak je gemak", "type":"flat_rate_shipping", "provider":"postnl", "price":"5", "tax":{ "name":"Taxable Goods", "id":"2", "rate":"21.0000" } }, { "id":"tablerate", "type":"flat_rate_shipping", "provider":"tablerate", "name":"test", "price":"2.0000", "tax":{ "name":"Taxable Goods", "id":"2", "rate":"21.0000" } } ]