AddInvoice
Description
The AddInvoice method adds a new Invoice object to the EBizCharge platform.
Syntax
InvoiceResponse AddInvoice(SecurityToken securityToken, Invoice invoice)
Arguments
Type | Name | Req. | Description |
|---|---|---|---|
securityToken | R | A unique token that is used to identify a merchant and authenticate the API request. | |
invoice | R | Details of the new invoice. Required Fields
If using the objects below, the following fields are required. Unused obects must be removed from the request. Item:
Recommended Fields
|
Return Value
| Type | Description |
|---|---|
| InvoiceResponse | Indicates whether the Invoice was added successfully. If successful, the response includes the assigned InvoiceInternalId. |
Example Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
<soapenv:Header/>
<soapenv:Body>
<ebiz:AddInvoice>
<ebiz:securityToken>
<ebiz:SecurityId>*************-4621-b899-************</ebiz:SecurityId>
<ebiz:UserId/>
<ebiz:Password/>
</ebiz:securityToken>
<ebiz:invoice>
<ebiz:CustomerId/>
<ebiz:SubCustomerId/>
<ebiz:InvoiceNumber>INV-030</ebiz:InvoiceNumber>
<ebiz:InvoiceDate/>
<ebiz:Currency/>
<ebiz:InvoiceAmount>1000.00</ebiz:InvoiceAmount>
<ebiz:InvoiceDueDate/>
<ebiz:AmountDue>500.00</ebiz:AmountDue>
<ebiz:PoNum/>
<ebiz:SoNum/>
<ebiz:DivisionId/>
<ebiz:Items>
<ebiz:Item>
<ebiz:ItemId>01-00097</ebiz:ItemId>
<ebiz:Name/>
<ebiz:Description/>
<ebiz:UnitPrice>1000.00</ebiz:UnitPrice>
<ebiz:Qty>1</ebiz:Qty>
<ebiz:Taxable>false</ebiz:Taxable>
<ebiz:TaxRate>0</ebiz:TaxRate>
<ebiz:UnitOfMeasure/>
<ebiz:TotalLineAmount>100</ebiz:TotalLineAmount>
<ebiz:TotalLineTax>10</ebiz:TotalLineTax>
<ebiz:ItemLineNumber>1</ebiz:ItemLineNumber>
<ebiz:GrossPrice>0</ebiz:GrossPrice>
<ebiz:WarrantyDiscount>0</ebiz:WarrantyDiscount>
<ebiz:SalesDiscount>0</ebiz:SalesDiscount>
<ebiz:ItemCustomFields>
<!--Zero or more repetitions:-->
<ebiz:EbizCustomField>
<ebiz:FieldId/>
<ebiz:FieldCaption/>
<ebiz:FieldName/>
<ebiz:FieldValue/>
<ebiz:FieldType/>
<ebiz:FieldDataType/>
<ebiz:FieldDescription/>
</ebiz:EbizCustomField>
</ebiz:ItemCustomFields>
</ebiz:Item>
</ebiz:Items>
<ebiz:Software/>
<ebiz:NotifyCustomer>false</ebiz:NotifyCustomer>
<ebiz:EmailTemplateID/>
<ebiz:InvoiceURL/>
<ebiz:TotalTaxAmount>10.00</ebiz:TotalTaxAmount>
<ebiz:InvoiceUniqueId/>
<ebiz:InvoiceDescription/>
<ebiz:InvoiceCustomerMessage/>
<ebiz:InvoiceMemo/>
<ebiz:InvoiceShipDate/>
<ebiz:InvoiceShipVia/>
<ebiz:InvoiceTermsId/>
<ebiz:InvoiceIsToBeEmailed>false</ebiz:InvoiceIsToBeEmailed>
<ebiz:InvoiceIsToBePrinted>false</ebiz:InvoiceIsToBePrinted>
<ebiz:DeliveryNumber/>
<ebiz:TotalDiscountAmount>0</ebiz:TotalDiscountAmount>
<ebiz:TotalShippingAmount>0</ebiz:TotalShippingAmount>
<ebiz:LocationId/>
<ebiz:PoDate/>
<ebiz:OrderedBy/>
<ebiz:InvoiceClass/>
<ebiz:InvoiceFOB/>
<ebiz:InvoiceTermsDescription/>
<ebiz:InvoiceCustomFields>
<!--Zero or more repetitions:-->
<ebiz:EbizCustomField>
<ebiz:FieldId/>
<ebiz:FieldCaption/>
<ebiz:FieldName/>
<ebiz:FieldValue/>
<ebiz:FieldType/>
<ebiz:FieldDataType/>
<ebiz:FieldDescription/>
</ebiz:EbizCustomField>
</ebiz:InvoiceCustomFields>
</ebiz:invoice>
</ebiz:AddInvoice>
</soapenv:Body>
</soapenv:Envelope>var client = new IeBizServiceClient();
SecurityToken securityToken = new SecurityToken();
Customer customer = new Customer();
securityToken.UserId = "";
securityToken.SecurityId = "********-90b4-4a38-ad78-********";
securityToken.Password = "";
Invoice invoice = new Invoice();
invoice.CustomerId = "C-E&000002";
invoice.SubCustomerId = "";
invoice.InvoiceNumber = "00102565";
invoice.InvoiceDate = "04/02/2016";
invoice.InvoiceDueDate = "08/12/2016";
invoice.InvoiceAmount = (decimal)2000.45;
invoice.AmountDue = (decimal)200.45;
invoice.DivisionId = "001";
invoice.PoNum = "Po001";
invoice.SoNum = "";
Item[] Lineitems = new Item[1];
Item item = new Item();
item.ItemId = "001";
item.Name = "Orange";
item.Description = "Orange";
item.Qty = 1;
item.UnitPrice = (decimal)200.25;
item.UnitOfMeasure = "EA";
item.Taxable = true;
item.TaxRate = (decimal)8.00;
item.TotalLineTax = (decimal)5.25;
item.TotalLineAmount = (decimal)205.25;
item.ItemLineNumber = 1;
Lineitems[0] = item;
invoice.Items = Lineitems;
InvoiceResponse Response = client.AddInvoice(securityToken, invoice);
Console.WriteLine(Response.Status);
Console.WriteLine(Response.StatusCode);
Console.WriteLine(Response.Error);
Console.WriteLine(Response.ErrorCode);function addInvoice()
{
$client = new SoapClient('End Point URL');
$securityToken = array(
'SecurityId' => '********-****-****-****-************',
'UserId' => '****',
'Password' => '****'
);
$lineItems[] = array(
'ItemId' => 'SKU-AC0012345',
'Name' => 'AC',
'Description' => 'AC Unit',
'UnitPrice' => 100,
'Taxable' => false,
'TaxRate' => 0,
'TaxAmount' => 0,
'DiscountAmount' => 0,
'DiscountRate' => 0,
'UnitOfMeasure' => 'EA',
'Qty' => 1,
'WarrantyDiscount' => 0,
'SalesDiscount' => 0,
'GrossPrice' => 100,
'TotalLineTax' => 0,
'TotalLineAmount' => 100,
'ItemLineNumber' => 1
);
$invoiceDetails = array(
'CustomerId' => '1',
'InvoiceNumber' => 'INV-20250411',
'InvoiceDate' => '04/11/2025',
'Currency' => 'USD',
'InvoiceAmount' => '100',
'InvoiceDueDate' => '05/11/2025',
'AmountDue' => '100',
'PoNum' => 'Po001',
'SoNum' => 'So001',
'TotalTaxAmount' => 0,
'InvoiceUniqueId' => '11',
'InvoiceDescription' => 'Sample Invoice',
'NotifyCustomer' => false,
'Software' => 'SOAPUI',
'Items' => $lineItems,
'BillingAddress' => array(
'FirstName' => 'Fname',
'LastName' => 'Lname',
'CompanyName' => 'EBizCharge',
'Address1' => '20 Pacifica',
'Address2' => 'Suite 1450',
'City' => 'Irvine',
'State' => 'CA',
'ZipCode' => '92618',
'Country' => 'USA'
),
'ShippingAddress' => array(
'FirstName' => 'Fname',
'LastName' => 'Lname',
'CompanyName' => 'EBizCharge',
'Address1' => '20 Pacifica',
'Address2' => 'Suite 1450',
'City' => 'Irvine',
'State' => 'CA',
'ZipCode' => '92618',
'Country' => 'USA'
)
);
$addInvoice = array(
'securityToken' => $securityToken,
'invoice' => $invoiceDetails
);
$response = $client->AddInvoice(
array(
'securityToken' => $securityToken,
'invoice' => $invoiceDetails
)
);
print_r($response);
}Example Response
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AddInvoiceResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
<AddInvoiceResult>
<InvoiceInternalId>********-4744-42f7-99fa-************</InvoiceInternalId>
<Status>Success</Status>
<StatusCode>1</StatusCode>
<Error/>
<ErrorCode>0</ErrorCode>
</AddInvoiceResult>
</AddInvoiceResponse>
</s:Body>
</s:Envelope><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AddInvoiceResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
<AddInvoiceResult>
<InvoiceInternalId/>
<Status>Error</Status>
<StatusCode>0</StatusCode>
<Error>Record already exists</Error>
<ErrorCode>2</ErrorCode>
</AddInvoiceResult>
</AddInvoiceResponse>
</s:Body>
</s:Envelope>Updated 6 months ago
What’s Next
