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

About the API System · Example API Usage · API Functions

API Functions
Add Client - Update Client - Delete Client - Get Clients - Get Clients Details - Get Clients Products - Get Clients Password - Send Email
Get Support Departments - Get Support Statuses - Get Tickets - Get Ticket - Get Ticket Predefined Cats - Get Ticket Predefined Replies
Open Ticket - Reply Ticket - Add Ticket Note - Delete Ticket
Module Create - Module Suspend - Module Unsuspend - Module Terminate
Create Quote - Update Quote - Delete Quote - Send Quote - Accept Quote
Get Orders - Get Order Statuses - Add Order - Accept Order - Pending Order - Cancel Order - Fraud Order - Delete Order
Get Invoice - Get Payment Methods - Create Invoice - Add Billable Item - Add Invoice Payment
Add Transaction - Add Credit - Capture Payment
Domain WHOIS Lookup - Get Activity Log - Get Admin Details - Update Admin Notes - Get Currencies - Get Email Templates
Get To-Do Items - Get To-Do Item Statuses - Get Staff Online - Get Stats - Encrypt Password - Decrypt Password