דוגמה ליצירת חשבונית מס קבלה באמצעות ה API המקוצר של iCount

ini_set("set_time_limit", "5");
ini_set("max_execution_time", "5");

$fields = array(

'compID' => 'Your_Company_Identifier',
'user' => 'user',
'pass' => 'password',

'docType' => 'receipt',
'dateissued' => date("Ymd"),

'clientname' => 'אלויס פרסלי',
'client_street_number' => '1124',
'client_street' => 'P.O. Box',
'client_city' => 'Ramat Hasharon',
'client_country' => 'Israel',
'client_zip' => '47111',

'banktransfer' => '1',
'depositedTo' =>'118-182788',
'totalBT' =>'1500',
'peraonDateBT' =>'2009-10-23',
	
'cheque' => '1',
'autoinvoice' => '0',

'chequeDate[0]' => '2009-10-23',
'chequeNumber[0]' => '101',
'chequeSnif[0]' => '118',
'acc[0]' => '182788',
'chequeBank[0]' => '11',
'chequeTotal[0]' => '200',

'chequeDate[1]' => '2009-11-23',
'chequeNumber[1]' => '101',
'chequeSnif[1]' => '118',
'acc[1]' => '182788',
'chequeBank[1]' => '11',
'chequeTotal[1]' => '200',


'credit' => '1',
'cc_cardtype[0]' => 'ויזה',
'cc_paymenttype[0]' => 'רגיל',
'cctotal[0]' => '100',
'ccfirstpayment[0]' => '100',
'cc_numofpayments[0]' => '1',
'cc_peraondate[0]' => '2009-11-23',
'cc_shovar[0]' => '12345',
'cc_cardnumber[0]' => '4321432143214321',
'cc_holdername[0]' => 'John Major',

'cc_cardtype[1]' => 'ישראכרט',
'cc_paymenttype[1]' => 'רגיל',
'cctotal[1]' => '200',
'ccfirstpayment[1]' => '200',
'cc_numofpayments[1]' => '1',
'cc_peraondate[1]' => '2009-11-23',
'cc_shovar[1]' => '12346',
'cc_cardnumber[1]' => '1234123412341234',
'cc_holdername[1]' => 'John Minor',


'paypal'=>'1',
'pp_sum'=>'155',
'pp_deal_number'=>'557788',
'pp_name_of_payer'=>'דון המשלם',
'pp_paydate' => '2009-10-24',

'barter'=>'1',
'barter_ammount'=>'20',

'cash'=>'1',
'cashammount'=>'100',


'hwc'=>"הערה ידנית:nחג שמח!!",


'ammountb4nicui' => '9900',
'nicui' => '0',
'totalammount' => '9900',
'currency'=>'2',
'rate'=>'3.96',



'show_response' => '1',



'lang' => 'he',
'sendOrig' => 'user@domain.co.il'
);

foreach($fields as $key=>$val) {
$string .= "$key=$val&";
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api.icount.co.il/api/create_doc.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"$string");
echo "-------------------------------------n";
curl_exec ($ch);
echo "-------------------------------------n";
curl_close ($ch);
die;