Order API

Give merchants ways to manage their orders

Order Entity

{
  "id":"40fbc8b0-edc0-11ea-869a-42010a0ca00e"
  "customerId":"536a15b9-c258-4136-ba58-07a59b5d2832"
  "createdAt":"2020-09-03T08:34:16.794544Z"
  "cartId":"4ae3dac3-9997-44ed-a097-debfe11a9886"
  "currency":"INR"
  "grossAmt":840
  "discountAmt":103.32
  "shippingAmt":100
  "netAmt":836.68
  "items":[]
  "addresses":[]
  "history":[]
}

Listing orders

Once orders are placed within the Zoko Web Application, you can list them using our API as follows. Use this to sync the orders with your fulfillment system.

List Orders reference section has details and granular filters you could apply to get your orders.

curl --request GET \
  --url https://ecom.api.zoko.io/v1/order \
  --header 'apikey: your-api-key-here'
const request = require('request');

const options = {
  method: 'GET',
  url: 'https://ecom.api.zoko.io/v1/order',
  headers: {apikey: 'your-api-key-here'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
import requests

url = "https://ecom.api.zoko.io/v1/order

headers = {"apikey": "your-api-key-her"}

response = requests.request("GET", url, headers=headers)

print(response.text)
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://ecom.api.zoko.io/v1/order")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["apikey"] = 'your-api-key-here'

response = http.request(request)
puts response.read_body

Response

{
 "start":1,
 "end":23,
 "page":1,
 "total":23,
 "more":false,
 "results": [
  {
    "id":"40fbc8b0-edc0-11ea-869a-42010a0ca00e"
    "customerId":"536a15b9-c258-4136-ba58-07a59b5d2832"
    "createdAt":"2020-09-03T08:34:16.794544Z"
    "cartId":"4ae3dac3-9997-44ed-a097-debfe11a9886"
    "currency":"INR"
    "grossAmt":840
    "discountAmt":103.32
    "shippingAmt":100
    "netAmt":836.68
    "items":[]
    "addresses":[]
    "history":[]
  }
  ]
}

Update Order Status

Once an order is fulfilled you can update the order in Zoko ECommerce

Checkout Update Order Status reference section for details.

curl --request PUT \
  --url https://ecom.api.zoko.io/v1/order/40fbc8b0-edc0-11ea-869a-42010a0ca00e \
  --header 'apikey: e202794d-15f6-487a-971b-5e2b6ea8a2a5' \
  --header 'content-type: application/json' \
  --data '{"status":"fulfilled"}'
const request = require('request');

const options = {
  method: 'PUT',
  url: 'https://ecom.api.zoko.io/v1/order/40fbc8b0-edc0-11ea-869a-42010a0ca00e',
  headers: {
    apikey: 'e202794d-15f6-487a-971b-5e2b6ea8a2a5',
    'content-type': 'application/json'
  },
  body: {status: 'fulfilled'},
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
import requests

url = "https://ecom.api.zoko.io/v1/order/40fbc8b0-edc0-11ea-869a-42010a0ca00e"

payload = {"status": "fulfilled"}
headers = {
    "apikey": "e202794d-15f6-487a-971b-5e2b6ea8a2a5",
    "content-type": "application/json"
}

response = requests.request("PUT", url, json=payload, headers=headers)

print(response.text)
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://ecom.api.zoko.io/v1/order/40fbc8b0-edc0-11ea-869a-42010a0ca00e")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["apikey"] = 'e202794d-15f6-487a-971b-5e2b6ea8a2a5'
request["content-type"] = 'application/json'
request.body = "{\"status\":\"fulfilled\"}"

response = http.request(request)
puts response.read_body

Response

{
  "id":"40fbc8b0-edc0-11ea-869a-42010a0ca00e"
  "type":"Order"
  "action":"update"
}



Next Step: Now let's try out Shipping API


Did this page help you?