Homepage | Client Area | Contact | Order Now »
WHMCS - The Complete Client Management, Billing & Support System
Article | Discussion | Edit | History Log in / create account

API:Create Invoice

From WHMCS Documentation

Jump to: navigation, search

This command is used to create a new invoice for a client.

Attributes

userid - should contain the user id of the client you wish to create the invoice for
date - the date the invoice is created in the format YYYYMMDD
duedate - the date the invoice is due in the format YYYYMMDD
taxrate - the rate of tax that should be charged
paymentmethod - the payment method for the invoice eg. banktransfer
notes - any additional notes the invoice should display to the customer
sendinvoice - set to true to send the "Invoice Created" email to the customer

itemdescription1 - item 1 description
itemamount1 - item 1 amount
itemtaxed1 - set to true if item 1 should be taxed
itemdescription2 - item 2 description
itemamount2 - item 2 amount
itemtaxed2 - set to true if item 2 should be taxed

etc...

Example Command

$postfields["action"] = "createinvoice";
$postfields["userid"] = "1";
$postfields["date"] = "20070101";
$postfields["duedate"] = "20070115";
$postfields["paymentmethod"] = "paypal";
$postfields["sendinvoice"] = true;
$postfields["itemdescription1"] = "Test Line Item 1";
$postfields["itemamount1"] = "10.00";
$postfields["itemtaxed1"] = 1;
$postfields["itemdescription2"] = "Test Line Item 2";
$postfields["itemamount2"] = "20.00";
$postfields["itemtaxed2"] = 0;

Returned Variables

invoiceid - the unique id of the invoice that was created

Main Page
Getting Started
Using WHMCS & Howto's
Customising WHMCS
Modules
API
Contributions

Search
 

What links here
Recent Changes
Privacy Policy
General Disclaimer
Copyright © WHMCS Ltd. 2005-2008. All Rights Reserved. UK Registered Company #6265962. Vat No. GB 927 7746 76