To integrate with other services and applications, we recommend setting up integration via Zapier.
You will be able to transfer data between services without the help of programmers.
Learn more about integration via Zapier

You can create new products in your JustClick shop by requesting a query to the API service using software methods. You can add a product only to the existing category.

The query is sent by the POST method in the URLencode format to the address: https://username.justclick.io/api/AddGood.

Where username is the login of the user in the system, as well as their domain of the third level in the JustClick service.

Parameters Transferred in the Query

  • good_name is the identifier of the new product; it must be unique within the account (required),
  • good_type is a type of product, can take values: 1 – physical, 0 – digital (required),
  • good_title is the product name (required)
  • parent_id is category ID, in which the product is added; the category should already exist,
  • good_sum is the price of the product (required),
  • good_api_url_notif is the URL for api notifications when the bill is paid (see more in the article),
  • good_api_url_new_order is the URL for api notifications when the invoice is created (see more in this article),
  • good_success_linkis the URL after successful payment; it is the page where the customer will be redirected to after successful payment,
  • good_client_rassilki are group identifiers separated by commas; customers will get into these groups after the order;  if there are no such groups, they will be created,
  • good_nalozh_only – (only for physical goods) determines whether to send the product by cash on delivery immediately after the formation of the order: 0 – no, 1 – yes,
  • good_quickpost_article is the article (identifier) ​​of the goods in the QuickPost delivery service,
  • good_post_service is the service that handles delivery; its possible values are none – deliver itself, quickpost – QuickPost,
  • good_only_countries are countries identifiers, where product delivery is available (using commas, without spaces!), if it is omitted, to deliver without restrictions, IDs can be viewed here,
  • good_download is the link for downloading the product; if the product is physical, then it might be for its digital copy,
  • good_mail_subject the subject of the letter that the customer will receive after payment,
  • good_mail_format is the html or text format of the letter,
  • good_mail_body is the html-code of the letter, if the html format is selected above,
  • good_mail_text – the text version of the letter after payment, if the text format is selected above,
  • good_partner_fee is the amount of the first-level partner commission in $,
  • good_partner_fee_perc is the first-level partner commission in % (percents),
  • good_partner_pfee is the amount of the second-level partner commission in $,
  • good_partner_pfee_perc is the second-level partner commission in % (percents),
  • good_partner_show determines whether you want to show this product in your partner’s advertising materials; possible values: 0 – no, 1 – yes,
  • good_partner_SL_link is the URL of the product description page (sales letter, Sales Letter),
  • good_partner_addition_link is the URL of the page with additional promotional materials,
  • good_partner_text is information for partners; a short note about the product appears in the partner’s advertising materials,
  • good_pay_text is the html code for the order payment page, here you can use the tags: # IMAGE #, # PRODUCT #, # PRICE #, # USD #,
  • good_timer is the time limit for order payment: 0 – no, 1 – yes,
  • good_timer_unit is the limit value; the possible values ​​are: min – in minutes, hour – in hours, day – in days,
  • good_timer_duration – the duration value of the restriction, the number that determines how many minutes, days or hours there is to pay for the order,
  • good_use_short determines whether to use a short link for the order page: 0 – no, 1 – yes,
  • good_rashod is the cost of manufacturing and sending the product in $, for more precise financial statistics,
  • good_rashod_perc are costs as a percentage of the product price (eg, taxes, etc.),
  • good_publish determines whether to display the product in the catalog: 0 – no, 1 – yes.

good_name, good_type, good_title and good_sum fields are the only fields required. The other query parameters are up to you.

The category ID can be taken from the shop in the “Category” section of the product editing section.

How Does It Work?

You send data for creating a product to the AddGood API function.

Your system will receive the result of the function performing.

The response is coded in JSON format. For more details, see the API Service Responses.

How to Find Out Partner’s ID and Advertising Tag ID, if It Was Based on Affiliate Reference Link

If you have an order page that is different from the default in the product settings, then justclick_partner_id and justclick_ad_id parameters, the partner’s ID and the advertisement tag will be transmitted when people are redirected to it. So, the affiliate link that looks as follows:

http://shop.YOUR_SHOP.com/aff/sl/PRODUCT/PARTNER/

will direct a user to the URL:

http://YOUR _WEBSITE.com/PURCHASE_PAGE/?YOUR_PARAMETERS&justclick_partner_id=PARTNER’S _ID&justclick_ad_id=ADVTAG_ID

In this way, you can find out the partner and the advertising tag, and form the parameters for creating an order using the API.

The purchase page can be set in the product editing block in the “Partnership” tab in the “URL of the product description page” field (it appears after ticking the check-box “Show partners”).

Example in PHP

In the example, we add a product with the “super_product” ID. The login in the system is “username”.

The data for creation are transmitted maximally, but you can limit yourself with 4 fields.

GetHash Function forms the hash to the transferred data.

CheckHash Function checks the hash to the service response.

 // Login to the JustClick system. 
 $user_rs['user_id'] = 'username';
  // The key for forming a hash. See API section (the link in the bottom right corner of the personal account).
 $user_rs['user_rps_key'] = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
 
 // Forming the array of bought goods for transferring to the API.
 $send_data = array(
	'good_name' => 'super_product',
	'good_type'			=> 'real', // product type: real or digital
	'good_title'			=> '10 DVD with cooking lessons', // <span style="font-weight: 400;" data-mce-style="font-weight: 400;">product name</span>
	'parent_id'			=> 111, //category ID
	'good_sum'			=> 999887, // product price in $
	'good_api_url_notif'		=> 'http://mysite.com/my_script_accepting_orders.php', // URL for API notifications about paid invoice
	'good_api_url_new_order' => 'http://mysite.com/my_script_ordering3.php', // URL for API notifications about created invoice
	'good_success_link'		=> 'http://mysite.com/thankyou_for_purchase.php', // URL after succesfull payment
	'good_client_mailings' 		=> 'second, clients_super_product', // group IDs separated by commas, where customers will get after the order	'good_nalozh_only' 		=> 0, // только для физического товара - высылать продукт наложенным платежом сразу после формирования заказа: 0 - нет, 1 - да
	'good_quickpost_article'	=> 12345678, // article (identifier) ​​of goods in the delivery service QuickPost
	'good_post_service'		=> 'quickpost', // the service that handles the delivery: 'none' - deliver it myself, 'quickpost' - QuickPost
	'good_only_countries'		=> 'US,UK', // limit on countries, where product delivery is possible (separated by a comma without spaces!)
	'good_download'			=> 'http://mysite.com/downloads/cooking_10dvd.zip',	//download link
	'good_mail_subject'		=> 'Thank you for purchase "10 DVD with cooking lessons"', // the subject of the letter after payment
	'good_mail_format'		=> 'text', // the format of the letter 'html' or 'text'
	'good_mail_body'		=> '', // html-code of the message
	'good_mail_text'		=> 'Thank you for purchase! Download link: {$download}', // the text version of the letter after payment
	'good_partner_fee'		=> 90, // first-level partner commission in$
	'good_partner_fee_perc'		=> '5', // first-level partner commission in %
	'good_partner_pfee'		=> 10, // second-level partner commissions in $
	'good_partner_pfee_perc'	=> '5', // second-level partner commissions in %
	'good_partner_show'		=> 1, // show whether there is a partner in the advertising materials: 0 - no, 1 - yes
	'good_partner_SL_link'		=> 'http://my_site.io/it_is_tasty.html', // URL of the product description page (sales letter, Sales Letter)
	'good_partner_addition_link'=> 'http://my_sitr.io/banners.html', // URL of the page with additional promotional materials
	'good_partner_text'=> 'Hello, world', // Information for partners
	'good_pay_text' => '<h1>Ordering</h1><div>#IMAGE#</div><h2>#PRODUCT#</h2><h3>#PRICE#</h3>', // html-code for payment page	 	 
        'good_timer' => 1, // time limit for order payment: 0 - no, 1 - yes	 
        'good_timer_unit' => 'day', // Limit value: 'min' - in minutes, 'hour' - in hours, 'day' - in days	 	 
        'good_timer_duration' => 2, // the duration value of the restriction (2 days)	 	 
        'good_use_short' => 0, // use a short link for the order page? 0 - no, 1 - yes	 	 
        'good_rashod' => 10, // expenses for manufacturing and sending the product in $	 	 
        'good_rashod_perc' => 6, // expenses in a percentage of the product price (taxes, etc.)	 	 
 'good_publish' => 1, // display the product in the catalog: 0 - no, 1 - yes	 	 
 );	 	 
// Forming the hash to the transmitted data	 	 
$send_data['hash'] = GetHash($send_data, $user_rs);	 	 
// Calling the AddGood function and decoding the received data	 	 
$resp = json_decode(Send('https://username.justclick.io/api/AddGood', $send_data));	 	 
// Checking the service response	 	 
if(!CheckHash($resp, $user_rs)){	 	 
 echo "Error! The response hash is not true!" ; print_r($resp);	 	 
 exit;	 	 
}	 	 
if($resp->error_code == 0)	 	 
 echo “The product is created”  Service Response: {$resp->error_text}";	 	 
else	 	 
 echo "Error code: {$resp->error_code} - description: {$resp->error_text}";	 	 
// ===========  Functions of sending, receiving and processing a response ============
// Sending the query to the  API service
function Send($url, $data)	 	 
{	 	 
 $ch = curl_init();	 	 
 curl_setopt($ch, CURLOPT_URL, $url);	 	 
 curl_setopt($ch, CURLOPT_POST, true);	 	 
 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));	 	 
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);	 	 
 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);	 	 
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // outputting the response to the variable	 	 
 $res = curl_exec($ch);	 	 
 curl_close($ch);	 	 
 return $res;	 	 
}	 	 
// Forming the transferred to the API data hash	 	 
function GetHash($params, $user_rs) {	 	 
 $params = http_build_query($params);	 	 
 $user_id = $user_rs['user_id'];	 	 
 $secret = $user_rs['user_rps_key'];	 	 
 $params = "$params::$user_id::$secret";	 	 
 return md5($params);	 	 
}	 	 
// Checking the received response hash	 	 
function CheckHash($resp, $user_rs) {	 	 
 $secret = $user_rs['user_rps_key'];	 	 
 $code = $resp->error_code;	 	 
 $text = $resp->error_text;	 	 
 $hash = md5("$code::$text::$secret");	 	 
 if($hash == $resp->hash)	 	 
 return true; // the hash is correct	 
 else	 	 
 return false; // the hash is not correct	 	 
}

Rate article

1 star2 stars3 stars4 stars5 stars (2 votes, avr.: 3.00 / 5)
Loading...