Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Ledger Drop Shipping API

Domains

Production domain : https://www.ledgerwallet.com Staging domain : http://vr.ledger.epicdream.fr

End points

To get shipping prices :

POST /api/drop_orders/shipping_price
  • Same params as create orders without shipping_method.
  • In address, only country is mandatory, but you will have more accurate estimation with zipcode.
  • Default currency is EUR, you can override it.

To create drop order :

POST /api/drop_orders
  • See params below
  • In address, name, address1, city, country, email, zipcode and phone_number are mandatory.

To get drop order informations :

GET /api/drop_orders/:uuid
  • See response below

To get drop orders list :

GET /api/drop_orders?limit=20&offset=0&order=desc
  • limit, offset and order params are optional.
  • See response below

To get countries and states name / code

GET /api/countries
GET /api/countries/:country_code/states
  • api_key is mandatory.

POST request example

{ "api_key": "c4257804-a1d7-4a57-ac92-f5901e3a731a", "test": true, "currency": "USD", // On shipping price only "drop_order": { "shipping_method": "shipwire.GD", // On order creation only "cart": [ {"sku": "lns-solo-en", "quantity": 1} ], "address": { "name": "Jean Martin", // Mandatory for order creation "company": "", "email": "jean.martin@mail.net", "phone_number": "555-5555", // Mandatory for order creation "address1": "1200 Main Street", // Mandatory for order creation "address2": "", "address3": "", "zipcode": "75001", // Mandatory for order creation, recommended for shipping price "city": "New York", // Mandatory for order creation "state": "NY", "country": "US" // Mandatory for shipping price and order creation } } }

Drop order creation POST request response (JSEND format)

{ "status" : "success" "data" : { "drop_order": { "id": 1, "status": "completed", "shipping_method": "shipwire.GD", "shipping_price": "4", "shipping_handling": "2.5", "cart": [ {"sku": "lns-solo-en", "quantity": 1} ], "address": { "uuid": "7d0935c129cbc4c50562acaa242e1afd", "name": "Jean Martin", "company": "", "email": "jean.martin@mail.net", "phone_number": "555-5555", "address1": "1200 Main Street", "address2": "", "address3": "", "zipcode": "75001", "city": "New York", "state": "NY" "state": "US" }, "trackings":[ {"url":"http://www.usps.com...", "shipping_delay":"2-3"} ] } } }

On wrong attributes :

{ "status" : "fail" "data" : ["zipcode is missing"] }

On server error (error 500)

{ "status" : "error" "message" : "Unexpected error. Our team has been notified." }

Shipping price POST request response (JSEND format)

{ "status" : "success", "data" : { "currency": "USD", "rates": [ {"code":"shipwire.GD","price":4.05,"delay":"4-7","carriers_codes":["USPS FC"],"carriers_descriptions":["USPS First-Class Mail Parcel + Delivery Confirmation"]}, {"code":"shipwire.2D","price":27.57,"delay":"4-4","carriers_codes":["FDX 2D"],"carriers_descriptions":["FedEx 2Day"]}, {"code":"shipwire.1D","price":34.63,"delay":"1-1","carriers_codes":["USPS XP"],"carriers_descriptions":["USPS Priority Mail Express"]} ] } }

Some examples

$ curl -H "Content-Type: application/json" -d "{"api_key":"e821389c-0ef0-49d4-9c7c-f69400699064","drop_order":{"cart":[{"sku":"lns-solo-en","quantity":1}],"address":{"zipcode":"","country":"US"}}}" http://vr.ledger.epicdream.fr/api/drop_orders/shipping_price => {"status":"fail","data":["zipcode is missing","lwn-solo-en not available"]}%

$ curl -H "Content-Type: application/json" -d "{"api_key":"e821389c-0ef0-49d4-9c7c-f69400699064","drop_order":{"cart":[{"sku":"lns-solo-en","quantity":1}],"address":{"zipcode":"75000","country":"US"}}}" http://vr.ledger.epicdream.fr/api/drop_orders/shipping_price => {"status":"success","data":{"rates":[{"code":"shipwire.GD","price":4.05,"delay":"4-7","carriers_codes":["USPS FC"],"carriers_descriptions":["USPS First-Class Mail Parcel + Delivery Confirmation"]},{"code":"shipwire.2D","price":27.57,"delay":"4-4","carriers_codes":["FDX 2D"],"carriers_descriptions":["FedEx 2Day"]}, {"code":"shipwire.1D","price":34.63,"delay":"1-1","carriers_codes":["USPS XP"],"carriers_descriptions":["USPS Priority Mail Express"]}]}}

$ curl -H "Content-Type: application/json" -d "{"api_key":"e821389c-0ef0-49d4-9c7c-f69400699064","drop_order":{"shipping_method":"shipwire.GD","cart":[{"sku":"lns-solo-en","quantity":1}],"address":{"zipcode":"75000","country":"US"}}}" http://vr.ledger.epicdream.fr/api/drop_orders => {"status":"fail","data":["Address name can't be blank","Address address1 can't be blank","Address city can't be blank","Name is missing."]}

$ curl -H "Content-Type: application/json" -d "{"api_key":"e821389c-0ef0-49d4-9c7c-f69400699064","drop_order":{"shipping_method":"shipwire.GD","cart":[{"sku":"lns-solo-en","quantity":1}],"address":{"name":"Toto","address1":"12 rue des lilas","zipcode":"75010","city":"Paris","state":"CA","country":"US","email":"example@mail.net","phone_number":"555-5555"}}}" http://vr.ledger.epicdream.fr/api/drop_orders => {"status":"success","data":{"drop_order":{"uuid":"054036703f99a2036490a2c431bc46f9","status":"pending_shipping","shipping_method":"shipwire.GD","shipping_price":null,"shipping_handling":null,"shipped_at":null,"delivered_at":null,"cart":[{"sku":"lns-solo-en","quantity":1}],"address":{"name":"Toto","company":null,"address1":"12 rue des lilas","address2":null,"address3":null,"city":"Paris","zipcode":"75010","phone_number":"555-5555","state":"CA","country":"US"},"trackings":[]}}}

$ curl "http://vr.ledger.epicdream.fr/api/drop_orders/054036703f99a2036490a2c431bc46f9?api_key=e821389c-0ef0-49d4-9c7c-f69400699064" => {"status":"success","data":{"drop_order":{"uuid":"054036703f99a2036490a2c431bc46f9","status":"pending_shipping","shipping_method":"shipwire.GD","shipping_price":null,"shipping_handling":null,"shipped_at":null,"delivered_at":null,"cart":[{"sku":"lns-solo-en","quantity":1}],"address":{"name":"Toto","company":null,"address1":"12 rue des lilas","address2":null,"address3":null,"city":"Paris","zipcode":"75010","phone_number":"555-5555","state":"CA","country":"US"},"trackings":[]}}}

$ curl "http://vr.ledger.epicdream.fr/api/drop_orders?api_key=e821389c-0ef0-49d4-9c7c-f69400699064" => {"status":"success","data":{"total":3,"drop_orders":[{"uuid":null,"status":"initialized","shipping_method":"shipwire.2D","shipping_price":null,"shipping_handling":null,"created_at":"2016-09-22T02:27:40.431Z","shipped_at":null,"delivered_at":null,"invoiced":false},{"uuid":null,"status":"initialized","shipping_method":"shipwire.2D","shipping_price":null,"shipping_handling":null,"created_at":"2016-09-22T02:27:52.876Z","shipped_at":null,"delivered_at":null,"invoiced":false},{"uuid":null,"status":"initialized","shipping_method":"shipwire.2D","shipping_price":null,"shipping_handling":null,"created_at":"2016-09-22T02:28:41.559Z","shipped_at":null,"delivered_at":null,"invoiced":false}]}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment