AddSalesOrder
Description
This method allows to add a new sales order to EBizCharge.
Syntax
SalesOrderResponse AddSalesOrder(SecurityToken securityToken , SalesOrder salesOrder).
Arguments
Type | Name | Description |
---|---|---|
SecurityToken | securityToken | Merchant security token: used to identify merchant and validate transaction. (required) |
SalesOrder | salesOrder | Includes sales order information, unique internal sales order ID assigned by EBizCharge, and sales order number. (required) |
Return Value
Type | Description |
---|---|
SalesOrderResponse | Returns result of AddSalesOrder request. |
Examples
function addSalesOrder()
{
$client = new SoapClient('End point URL');
$securityToken = array(
'SecurityId' => '******-454757-4567457-********',
'UserId' => 'merchant1',
'Password' => 'merchant1'
);
$shippingAddress = array(
'FirstName' => 'Rachel',
'LastName' => 'Bayswater',
'Company' => 'Abyss',
'Address1' => 'ST # 8 HS 9 London',
'Address2' => 'ST # 1 HS 11 London',
'City' => 'London',
'State' => 'London',
'ZipCode' => 'E1 6AN',
'Country' => 'UK',
'Phone' => '233-23445',
'Fax' => '233-234432',
'Email' => '[email protected]'
);
$billingAddress = array(
'FirstName' => 'Hello',
'LastName' => 'There',
'Company' => 'Abyss',
'Address1' => 'ST # 266 HS 102 London',
'Address2' => 'ST # 566 HS 21 London',
'City' => 'London',
'State' => 'London',
'ZipCode' => 'E1 6AN',
'Country' => 'UK',
'Phone' => '456-23445',
'Fax' => '456-234432',
'Email' => '[email protected]'
);
$orderDetails = array(
'CustomerId' => 1,
'SalesOrderNumber' => 'So107',
'Date' => '2020-05-01',
'Currency' => 'USD',
'Amount' => '200',
'DueDate' => '2020-05-01',
'AmountDue' =>'200',
'PoNum' => 'po001',
'DateUploaded' => '2020-05-01',
'DateUpdated' => '2020-05-01',
'Software' => 'Woocommerce',
'NotifyCustomer' => 'true',
'TotalTaxAmount' => 0,
'UniqueId' => '123',
'Description' => 'Sales Order',
'CustomerMessage' => 'Hello',
'Memo' => '',
'ShipDate' => '2020-05-05',
'ShipVia' => '',
'IsToBeEmailed' => false,
'BillingAddress' => $billingAddress,
'ShippingAddress' => $shippingAddress
);
$addSalesOrder = array(
'securityToken' => $securityToken,
'salesOrder' => $orderDetails
);
$addSalesOrderResponse = $client->AddSalesOrder($addSalesOrder);
$addOrderOrderResult = $addSalesOrderResponse->AddSalesOrderResult;
}
Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
<soapenv:Header/>
<soapenv:Body>
<ebiz:AddSalesOrder>
<ebiz:securityToken>
<ebiz:SecurityId>********-1906-4be3-b01d-********</ebiz:SecurityId>
<ebiz:UserId>id1</ebiz:UserId>
<ebiz:Password>pass1</ebiz:Password>
</ebiz:securityToken>
<ebiz:salesOrder>
<ebiz:CustomerId>AIM</ebiz:CustomerId>
<ebiz:SubCustomerId/>
<ebiz:SalesOrderNumber>So107</ebiz:SalesOrderNumber>
<ebiz:Date>2019-07-01</ebiz:Date>
<ebiz:Amount>125.45</ebiz:Amount>
<ebiz:DueDate>2019-07-20</ebiz:DueDate>
<ebiz:AmountDue>100.25</ebiz:AmountDue>
<ebiz:PoNum>po001</ebiz:PoNum>
<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>01-00098</ebiz:ItemId>
<ebiz:Name>01-00099</ebiz:Name>
<ebiz:Description>TV</ebiz:Description>
<ebiz:UnitPrice>2000.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>2000.25</ebiz:TotalLineAmount>
<ebiz:TotalLineTax>10.00</ebiz:TotalLineTax>
<ebiz:ItemLineNumber>1</ebiz:ItemLineNumber>
</ebiz:Item>
</ebiz:Items>
<ebiz:Software>qb</ebiz:Software>
<ebiz:NotifyCustomer>true</ebiz:NotifyCustomer>
<ebiz:EmailTemplateID/>
<ebiz:URL/>
<ebiz:TotalTaxAmount>20.25</ebiz:TotalTaxAmount>
<ebiz:UniqueId>Sr001</ebiz:UniqueId>
<ebiz:Description>Sales Order</ebiz:Description>
<ebiz:BillingAddress>
<ebiz:FirstName>Rachel</ebiz:FirstName>
<ebiz:LastName>Bayswater</ebiz:LastName>
<ebiz:CompanyName>CBS</ebiz:CompanyName>
<ebiz:Address1>55 Golden</ebiz:Address1>
<ebiz:Address2/>
<ebiz:Address3/>
<ebiz:City>Abyss</ebiz:City>
<ebiz:State>CA</ebiz:State>
<ebiz:ZipCode>56789</ebiz:ZipCode>
<ebiz:Country/>
<ebiz:IsDefault>0</ebiz:IsDefault>
<ebiz:AddressId></ebiz:AddressId>
</ebiz:BillingAddress>
<ebiz:ShippingAddress>
<ebiz:FirstName>Rachel</ebiz:FirstName>
<ebiz:LastName>Bayswater</ebiz:LastName>
<ebiz:CompanyName>CBS</ebiz:CompanyName>
<ebiz:Address1>55 Golden</ebiz:Address1>
<ebiz:Address2/>
<ebiz:Address3/>
<ebiz:City>Abyss</ebiz:City>
<ebiz:State>CA</ebiz:State>
<ebiz:ZipCode>56788</ebiz:ZipCode>
<ebiz:Country/>
<ebiz:IsDefault>0</ebiz:IsDefault>
<ebiz:AddressId>?</ebiz:AddressId>
</ebiz:ShippingAddress>
<ebiz:CustomerMessage>Hello</ebiz:CustomerMessage>
<ebiz:Memo>Hello</ebiz:Memo>
<ebiz:ShipDate>2019-07-08</ebiz:ShipDate>
<ebiz:ShipVia>USPS</ebiz:ShipVia>
<ebiz:SalesRepId>Jef04</ebiz:SalesRepId>
<ebiz:TermsId>Net30</ebiz:TermsId>
<ebiz:IsToBeEmailed>0</ebiz:IsToBeEmailed>
<ebiz:IsToBePrinted>0</ebiz:IsToBePrinted>
</ebiz:salesOrder>
</ebiz:AddSalesOrder>
</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">
<AddSalesOrderResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
<AddSalesOrderResult>
<SalesOrderInternalId>********-56d6-45e3-a7e1-********</SalesOrderInternalId>
<Status>Success</Status>
<StatusCode>1</StatusCode>
<Error/>
<ErrorCode>0</ErrorCode>
</AddSalesOrderResult>
</AddSalesOrderResponse>
</s:Body>
</s:Envelope>
public void AddSalesorder()
{
eBizService apiClient = new eBizService();
SecurityToken securityToken = new SecurityToken
{
SecurityId = "*******-c870-41b8-aa5c-********",
UserId = "",
Password = ""
};
SalesOrder salesOrder = new SalesOrder();
salesOrder.CustomerId = "APIINVCust";
salesOrder.SubCustomerId = "";
salesOrder.SalesOrderNumber = "91025630";
salesOrder.Date = "04/10/2022";
salesOrder.DueDate = "04/30/2021";
salesOrder.AmountDue = (decimal)216.27;
salesOrder.TotalTaxAmount = (decimal)16.02;
salesOrder.AmountDue = (decimal)216.27;
salesOrder.PoNum = "PO123";
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)16.02;
item.TotalLineAmount = (decimal)216.27;
item.ItemLineNumber = 1;
Lineitems[0] = item;
salesOrder.Items = Lineitems;
//Add Shipping Address
salesOrder.ShippingAddress = new Address();
//Add Billing Address
salesOrder.BillingAddress = new Address();
var response = apiClient.AddSalesOrder(securityToken, salesOrder);
Console.WriteLine(response.Status);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Error);
Console.WriteLine(response.ErrorCode);
Console.ReadLine();
}
Updated over 2 years ago