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

Add Product To Cart

This API use for add product to cart.

Method= POST

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

Headers

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
plateform plateform of user, D is desktop,A is android Yes
user_id user id of user Yes
cart_service_id cart service id Yes
product_id product id Yes
ammount ammount of product Yes

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/cart/addProductToCart
Sandbox Url:
https://sandbox.shopclues.com/api/v2/cart/addProductToCart

Sample request:

{  
   "platform":"A",  
   "user_id":12312312312,  
   "cart_service_id":1,  
   "return_cart":1,  
    "product_data":{  
       "1":{  
           "product_id":1238864,  
           "amount":1  
       }  
   }  
}

Sample response:

 {  
 "status": 1,  
 "code": 200,  
 "message": "success",  
 "data": {  
   "count": 1,  
   "cart_id": 34076470,  
   "plaform": "A",  
   "max_purchase_qty": 999,  
   "products": [  
     {  
       "product_id": "1238864",  
       "name": "Accu-ChekActive Glucose Monitor",  
       "company_id": "1877",  
       "weight": "1000",  
       "seo_name": "accu-chek-active-glucose-monitor-11",  
       "product_group": "0",  
       "min_qty": "0",  
       "category_name": "Sports & Health",  
       "product_level_price_total": 999,  
       "product_level_price_total_without_discount": 999,  
       "product_level_discount": 0,  
       "per_product_avg_price_without_shipping": 999,  
       "per_product_avg_price_with_shipping": 999,  
       "item_id": "2332300494",  
       "amount": "441",  
       "is_cod": "1",  
       "reward_info": {  
         "reward_point_id": "1220",  
         "object_id": "0",  
         "amount_type": "P",  
         "object_type": "G",  
         "amount": "2"  
       },  
       "quantity": 1,  
       "selling_price": 999,  
       "price": [  
         {  
           "price": "999.00",  
           "quantity": 1  
         }  
       ],  
       "product_pre_price_total": 999,  
       "product_pre_price_total_discount": 0,  
       "previous_third_price": "0.00",  
       "shipping": {  
         "per_product_shipping_amt": 0,  
         "total_shipping_amt": 0,  
         "shipping_delta_amount": 0,  
         "shipping_delta_type": "delta_shipping_fee",  
         "per_product_previous_shipping_amt": 0,  
         "change_in_shipping": "0"  
       }  

Click here for access token documentation.

<?php

$token="<token>";
$oauth_url = 'https://sandbox.shopclues.com/api/v2/cart/addProductToCart';   
$credentials = array(
"Authorization"=>"Bearer .$token",
"Content-Type"=> "application/json", 
"platform"=>"A",  
   "user_id"=>12312312312,  
   "cart_service_id"=>1,  
   "return_cart"=>1,  
    "product_data"=>array(  
       "1"=>array(  
           "product_id"=>1238864,  
           "amount"=>1  
       )  
    )
);

function addProduct($oauth_url, $credentials)
{
 
$curl = curl_init($oauth_url);
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
),
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => json_encode($credentials)
));
$response = curl_exec($curl);
curl_close($curl);
$response = json_decode($response, true);
return $response;
}

$token = addProduct($oauth_url, $credentials);  
print_r($token) ;  

?>

Example Response

{
  "access_token": "d6dd694565e5c76acd7b34451156f0c",
  "expires_in": 3600,
  "token_type": "Bearer",
  "scope": "read_placeorder write_placeorder 
  read_paymentservice ",
  "refresh_token": "081acccb993456c9e157e7684b1d7dd137eb2a087"
}

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.