WHMCS如何通过API创建发票使用PHP代码

时间:2018-06-06 03:22:15

标签: api whmcs

  

您好我被困了,我只想知道如何通过发送发票   API可以有人给我样本可运行的代码,帮助我和   解释他的网址,我应该使用哪一个。

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.localhost/api/createinvoice.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    http_build_query(
        array(
            'action' => 'CreateInvoice',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'saurabh100',
            'password' => 'saurabh100',
            'userid' => '1',
            'status' => 'Unpaid',
            'sendinvoice' => '1',
            'paymentmethod' => 'mailin',
            'taxrate' => '10.00',
            'date' => '2016-01-01',
            'duedate' => '2016-01-08',
            'itemdescription1' => 'Sample Invoice Item',
            'itemamount1' => '15.95',
            'itemtaxed1' => '0',
            'itemdescription2' => 'Sample Second Invoice Item',
            'itemamount2' => '1.00',
            'itemtaxed2' => '1',
            'autoapplycredit' => '0',
            'responsetype' => 'json',
        )
    )
);
echo "<pre>";print_r($ch);die;

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);

?>

0 个答案:

没有答案