Top
Developers Your place to code all things handmade

Welcome to the Shopclues Developer Platform

We believe in code as craft. Join the community of developers, creators and build tools that enrich the ways you can shop, sell and connect with the India's largest merchant base most easily.

Get Started

Register, Upload, Search and Connect

Explore Shopclues' marketplace of over 8.5 million products from over 3.5 lakh merchants. Connect buyers with the items they'll love.

Learn More About Catalog Management

Login, Integrate and Create

Build the best tools for Shopclues merchants. Simply login, Integrate and start developing you own apps.

Learn More About Start Developing
<
>
Jump to: navigation, search

Create Order

This api use for create order.

Method= POST

Headers

Authorization : “Bearer bc1f461de4f193”
Content-Type : ”application/json”

Field name Description Mandatory
Header - “Authorization” Access token is passed to identify the user. Eg- ”Bearer bc1f461de4f193" Yes
Header - “Content-Type” Input Content Type here it would be “application/json" Yes

Field Description:

Field name Description Mandatory
cart_service_id To be passed default 1 Yes
payment_option_id Payment Mode

61 : for COD order Any other valid is prepaid

Yes
product_data Product we want to add in cart :: {"1":{"product_id":108547267,"amount":1},"2":{"product_id":12312,"amount":1}}Product Data for Variant Product :: {"1":"product_id":108547267,"amount":1,"product_options": {"variant1":"variant1_option1","variant2":"variant2_option1"}

}}

Yes
transaction_id Unique Id to be passed by user.

If order already exists with given id then that order is returned otherwise new order placed is mapped with this unique id.

No
user_profile_id Profile for which we want to placeorder, dont need this if new profile to be created. NOTE : this profile id has preference over creating new profile. No
b_firstname billing name Yes (if no profile passed)
b_lastname billing last name No (if profile id passed)
b_address billing address. No (if u want to copy shipping

details into billing)

b_address2 billing address2 No
b_city billing city No
b_state billing city No
b_zipcode Billing Zipcode No
b_phone billing phone No
s_firstname Shipping first name Yes(if no profile passed)
s_lastname Shipping last name No(if profile id passed)
s_address shipping address No (if you want to copy billing into shipping)
s_address2 shipping adddress2 No
s_city shipping city No
s_state shipping state No
s_zipcode shipping zipcode No
s_phone shipping phone No

Details of return parameters :

Variable Description
status Api status if 1: implies success , 0:implies fail error.
message Text response message
data Array of user with basic parameters. For detailed information about a user.

  • JSON
  • PHP
Production Url: :
 https://developer.shopclues.com/api/v2/order/createOrder
Sandbox Url: :
https://sandbox.shopclues.com/api/v2/order/createOrder

Sample request:

{
    "platform": "D",
    "cart_service_id": 1,
    "payment_option_id": 159,
    "product_data": {
    "1": {
            "product_id": "90453612",
            "amount": 1,
            "product_options": {
                "467801": "5385761"
            }
        }
    },
    "b_firstname": "Anubhav",
    "b_lastname": "Nigam",
    "b_address": "somewhere close",
    "b_address_2": "",
    "b_city": "Jhansi",
    "b_state": "UTTAR PRADESH",
    "b_zipcode": 284001,
    "b_phone": "9891374468",
    "s_firstname": "Anubhav Nigam",
    "s_lastname": "Anubhav Nigam",
    "s_address": "somewhere close",
    "s_city": "Jhansi",
    "s_state": "UTTAR PRADESH",
    "s_zipcode": 284001,
    "s_phone": "9891374468",
    "address_type": "test"
}

Sample response:

{
    "status": 1,
    "code": 200,
    "message": "success",
    "data": {
        "order_id": "133634006",
        "is_parent_order": "N",
        "parent_order_id": "0",
        "company_id": "432339",
        "total": "431.00",
        "subtotal": "394.00",
        "discount": "636.00",
        "subtotal_discount": "0.00",
        "timestamp": "1511771313",
        "status": "100",
        "payment_option_id": "113",
        "cod_fee": "0.00",
        "payment": {
            "payment_id": "45",
            "payment_option_id": "113"
        },
        "user": {
            "profile_id": "85350298",
            "user_id": "37824852",
            "firstname": "Helpu",
            "lastname": null,
            "email": "info@helpu.me"
        },
        "promotions": {
            "promotion_id": [
                "3314893",
                "6545772"
            ]
        },
        "products": {
            "3678197697": {
                "item_id": "3678197697",
                "product_id": "90453612"
            }
        }
    },
    "extra": null
}


Error case 1: Order Already Placed with given transaction_id (5202)

{"response_time":0.084,"status":5202,"message":"12345690
10","data":[]}

Error case 2: Invalid Product Id(3001):

{"response_time":0.301,"status":3001,"message":"Invalid
product id","data":[]}

Error case 3 Invalid Profile Details (5007):

{"response_time":1.11,"status":5007,"message":"Mandatory
field missing in profile_id|74211344","data":[]}


Click here for access token documentation.

<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://sandbox.shopclues.com/api/v2/order/createOrder",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{
'platform': 'D',
  'cart_service_id': 1,
  'payment_option_id': 159,
  'product_data': {
    '1': {
      'product_id': '91270479',
      'amount': 1,
      'product_options': {
        '471320': '5402963'
      }
    }
  },
  'b_firstname': 'Deepak',
  'b_lastname': 'Fajf',
  'b_address': 'dfa',
  'b_address_2': 'dfadsf',
  'b_city': 'North Delhi',
  'b_state': 'DELHI',
  'b_zipcode': 110085,
  'b_phone': '9540674989',
  's_firstname': 'Anubhav Nigam',
  's_lastname': 'Anubhav Nigam',
  's_address': 'somewhere close',
  's_city': 'Jhansi',
  's_state': 'UTTAR PRADESH',
  's_zipcode': 284001,
  's_phone': '9891374468',
  'address_type': 'test'
}",
  CURLOPT_HTTPHEADER => array(
    "authorization: Bearer b281fe887589f9cec0ea2c068bbe5d8725e3f06b",
    "content-type: application/json",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
?>

Looking for ShopClues Apps?

Check out our new
App Gallery!

It's the best way to find cool and useful tools built upon Shopclues's API.