'1000', #Company Terminl Number - 1000 is test termianl 'UserName'=>'ayalon3', #Company User Name , contact support to get a uniqe user name for testring 'InvoiceType'=>'1', #Invoice Type 1-> Invoice , 2-> Invoice refund. #Invoice Head Info : 'InvoiceHead.CustName'=>'Test userinvoice', # required 'InvoiceHead.CustAddresLine1'=>'address line 1', 'InvoiceHead.CustAddresLine2'=>'address line 1', 'InvoiceHead.CustCity'=>'City', 'InvoiceHead.CustLinePH'=>'Phone line', 'InvoiceHead.CustMobilePH'=>'Phone Mobile', 'InvoiceHead.CompID'=>'512542145', 'InvoiceHead.Language'=>'en', #required : en for english , he for hebrew 'InvoiceHead.Comments'=>'thanks for buing', 'InvoiceHead.CoinID'=>'2', # required : 1-NIS , 2-USD 'InvoiceHead.Email'=>'CustomerEmail@ForInvoice.com', 'InvoiceHead.SendByEmail'=>'true', # required 'InvoiceHead.ExtIsVatFree'=>'true', # False = 17% OR True = 0% VAT #Invoice Lines : #Line zero: 'InvoiceLines.Description'=>'product 1', # required 'InvoiceLines.Price'=>'10', # required 'InvoiceLines.Quantity'=>'1', # required 'InvoiceLines.IsPriceIncludeVAT'=>'true', # required # total line zero is: 10*1 = 10.00 #Line one 'InvoiceLines1.Description'=>'product 2', # required 'InvoiceLines1.Price'=>'20.5', # required 'InvoiceLines1.Quantity'=>'2', # required 'InvoiceLines1.IsPriceIncludeVAT'=>'true', # required # total line one is: 20.50*2 = 41.00 #Line two 'InvoiceLines2.Description'=>'product commensts', # required 'InvoiceLines2.Price'=>'0', # required 'InvoiceLines2.Quantity'=>'1', # required 'InvoiceLines2.IsPriceIncludeVAT'=>'true', # required # total line two is:0*1 = 0 : will show on invoice but no price at line #total Invoice : 51.00 #invoice pay using : #cash 'cash'=>'11', #PayPal 'CustomPay.TransactionID'=>'32', # PayPal 'CustomPay.TranDate'=>'31/12/2012', 'CustomPay.Description'=>'PayPal Payments', 'CustomPay.Asmacta'=>'X12345ZZ', 'CustomPay.Sum'=>'40' ); # urlencode the information $urlencoded = http_build_query($vars); #init curl connection if( function_exists( "curl_init" )) { $CR = curl_init(); curl_setopt($CR, CURLOPT_URL, 'https://secure.cardcom.co.solutions/Interface/CreateInvoice.aspx'); curl_setopt($CR, CURLOPT_POST, 1); curl_setopt($CR, CURLOPT_FAILONERROR, true); curl_setopt($CR, CURLOPT_POSTFIELDS, $urlencoded ); curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1); curl_setopt($CR, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($CR, CURLOPT_FAILONERROR,true); #actual curl execution perfom $result = curl_exec( $CR ); $error = curl_error ( $CR ); # some error , send email to developer if( !empty( $error )) { echo $message; return; } curl_close( $CR ); } parse_str($result); # ResponseCode=5033&Description=Terminal Number is Missing&InvoiceNumber=0&InvoiceType=0 if (isset($ResponseCode)&&$ResponseCode == '0') // Invoice Created OK! { # Save Invoice number and Type to DB : echo 'Invoice Number:'.$InvoiceNumber.' Invoice Type:'.$InvoiceType; }else # some error , send email to developer { echo 'error'; echo $result; } ?>