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 change the settings of the product existing in your JustClick shop by requesting a query to the API service using software methods. You can change each product only once using the function.

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

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_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 fields is the only field 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 product ID and its settings to replace the existing ones to the UpdateGood 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.

Example in PHP

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

The data for changing are transmitted maximally, but you can send only the settings you need to change.

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 right bottom 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_title'=> 'Super Product 3000', // product name
	'parent_id' => 111, // category ID
	'good_sum' => 999887, // product price in $
	'good_api_url_notif' => 'http://my_site.io/my_script.php', // URL for API notifications about paid invoice
	'good_api_url_new_order' => 'http://my_site.io/my_script2.php', // URL for API notifications about created invoice
	'good_success_link' => 'http://my_site.io/my_script3.php', // URL after successful payment
	'good_client_rassilki' => 'second, clients_super_product', // group IDs separated by commas, where customers will get after the order
	'good_nalozh_only' => 0, // only for physical goods, whether to send the product by cash on delivery immediately after the formation of the order: 0 - no, 1 - yes
	'good_quickpost_article' => 12345678, // article (identifier) of goods in the delivery service QuickPost
	'good_only_countries' => 'USA,GB', // the service that handles the delivery: 'none' - deliver it myself, 'quickpost' - QuickPost
	'good_download'	=> 'http://my_site.io/downloads/product_10dvd.zip', //download link
	'good_mail_subject'=> 'Thank you for your purchase', // 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 your 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/the_best_product.html', // URL of the product description page (sales letter, Sales Letter)
	'good_partner_addition_link'=> 'http://my_site.io/banners.html', // URL of the page with additional promotional materials
	'good_partner_text'=> 'It's so cool', // 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 UpdateGood function and decoding the received data	 	 
$resp = json_decode(Send('http://username.justclick.io/api/UpdateGood', $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 updated.”  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 (1 votes, avr.: 1.00 / 5)
Loading...