AddInvoice
Description
This method is used to add a new invoice to EBizCharge.
Syntax
InvoiceResponse AddInvoice(SecurityToken securityToken, Invoice invoice)
Arguments
Type | Name | Description |
---|---|---|
SecurityToken | securityToken | Merchant security token: used to identify merchant and validate transaction. (required) |
Invoice | invoice | Includes invoice information, such as invoice number, invoice date, and items. (required) |
Return Value
Type | Description |
---|---|
InvoiceResponse | Returns result of AddInvoice request. |
Examples
function addInvoice()
{
$client = new SoapClient('End point URL');
$securityToken = array(
'SecurityId' => '********-454757-4567457-********',
'UserId' => 'merchant1',
'Password' => 'merchant1'
);
$invoiceDetails = array(
'CustomerId' => 1,
'InvoiceNumber' => '123',
'InvoiceDate' => '05/13/2020',
'Currency' => 'USD',
'InvoiceAmount' => '200',
'InvoiceDueDate' => '05/13/2020',
'AmountDue' => '200',
'PoNum' => 'Po001',
'SoNum' => '',
'TotalTaxAmount' => 0,
'InvoiceUniqueId' => '11',
'InvoiceDescription' => 'testing',
'NotifyCustomer' => 'false',
'Software' => 'Woocommerce'
);
$addInvoice = array(
'securityToken' => $securityToken,
'invoice' => $invoiceDetails
);
$addInvoiceResponse = $client->AddInvoice($addInvoic);
$addInvoiceResult = $addInvoiceResponse->AddInvoiceResult;
}
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>********-90b4-4a38-********</ebiz:SecurityId>
<ebiz:UserId/>
<ebiz:Password/>
</ebiz:securityToken>
<ebiz:invoice>
<ebiz:CustomerId>CBS</ebiz:CustomerId>
<ebiz:SubCustomerId/>
<ebiz:InvoiceNumber>Inv1-011</ebiz:InvoiceNumber>
<ebiz:InvoiceDate>2017-01-01</ebiz:InvoiceDate>
<ebiz:Currency>USD</ebiz:Currency>
<ebiz:InvoiceAmount>1000.00</ebiz:InvoiceAmount>
<ebiz:InvoiceDueDate>2016-04-02</ebiz:InvoiceDueDate>
<ebiz:AmountDue>5</ebiz:AmountDue>
<ebiz:PoNum>PO001</ebiz:PoNum>
<ebiz:SoNum>SO001</ebiz:SoNum>
<ebiz:DivisionId>0001</ebiz:DivisionId>
<ebiz:TypeId>Invoice</ebiz:TypeId>
<ebiz:Items>
<ebiz:Item>
<ebiz:ItemId>01-00097</ebiz:ItemId>
<ebiz:Name>01-00097</ebiz:Name>
<ebiz:Description>Wall Mounted Vent-free Gas Fireplace</ebiz:Description>
<ebiz:UnitPrice>20.25</ebiz:UnitPrice>
<ebiz:Qty>10.00</ebiz:Qty>
<ebiz:Taxable>true</ebiz:Taxable>
<ebiz:TaxRate>0</ebiz:TaxRate>
<ebiz:UnitOfMeasure>EA</ebiz:UnitOfMeasure>
<ebiz:TotalLineAmount>200.25</ebiz:TotalLineAmount>
<ebiz:TotalLineTax>10.00</ebiz:TotalLineTax>
<ebiz:ItemLineNumber>1</ebiz:ItemLineNumber>
</ebiz:Item>
<ebiz:Item>
<ebiz:ItemId>Orange</ebiz:ItemId>
<ebiz:Name>Orange</ebiz:Name>
<ebiz:Description>Orange County CA Sales Tax</ebiz:Description>
<ebiz:ItemLineNumber>2</ebiz:ItemLineNumber>
</ebiz:Item>
</ebiz:Items>
<ebiz:Software>QuickBooks</ebiz:Software>
<ebiz:NotifyCustomer>false</ebiz:NotifyCustomer>
<ebiz:EmailTemplateID/>
<ebiz:InvoiceURL>https://www.ebizcharge.net/uploads/invoice001.pdf</ebiz:InvoiceURL>
<ebiz:TotalTaxAmount>10.00</ebiz:TotalTaxAmount>
<ebiz:InvoiceUniqueId>x123-456-123</ebiz:InvoiceUniqueId>
</ebiz:invoice>
</ebiz:AddInvoice>
</soapenv:Body>
</soapenv:Envelope>
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>
<Status>Success</Status>
<StatusCode>1</StatusCode>
<Error/>
<ErrorCode>0</ErrorCode>
</AddInvoiceResult>
</AddInvoiceResponse>
</s:Body>
</s: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);
Updated about 2 years ago