AddSalesOrder

Description

The AddSalesOrder method adds a new SalesOrder object to the EBizCharge platform.

Upon creation, the sales order is assigned a unique identifier (SalesOrderInternalId) by EBizCharge.

Syntax

SalesOrderResponse AddSalesOrder(SecurityToken securityToken, SalesOrder salesOrder)

Arguments

Type

Name

Req.

Description

SecurityToken

securityToken

R

A unique token that is used to identify a merchant and authenticate the API request.

SalesOrder

salesOrder

R

The new sales order to add.

Required Fields
  • CustomerId
  • Amount
  • AmountDue
  • NotifyCustomer
  • TotalTaxAmount
  • IsToBeEmailed
  • IsToBePrinted

If using the objects below, the following fields are required. Unused obects must be removed from the request.

Item:

  • UnitPrice
  • Qty
  • Taxable
  • TaxRate
  • TotalLineAmount
  • TotalLineTax
  • ItemLineNumber
  • GrossPrice
  • WarrantyDiscount
  • SalesDiscount

Address:

  • IsDefault
Recommended Fields
  • SalesOrderNumber
  • Date - Default is 1900-01-01
  • DueDate - Default is 1900-01-01

Return Value

TypeDescription
SalesOrderResponseIndicates whether the SalesOrder was successfully added.

Example 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>*************-4621-b899-************</ebiz:SecurityId>
            <ebiz:UserId/>
            <ebiz:Password/>
         </ebiz:securityToken>
         <ebiz:salesOrder>
            <ebiz:MerchantId/>
            <ebiz:CustomerId>BCustomer</ebiz:CustomerId>
            <ebiz:SubCustomerId/>
            <ebiz:SalesOrderNumber>SO-1904</ebiz:SalesOrderNumber>
            <ebiz:Date/>
            <ebiz:Currency/>
            <ebiz:Amount>125.45</ebiz:Amount>
            <ebiz:DueDate/>
            <ebiz:AmountDue>100.25</ebiz:AmountDue>
            <ebiz:PoNum/>
            <ebiz:DivisionId/>
            <ebiz:TypeId/>
            <ebiz:Items>
               <!--Zero or more repetitions:-->
               <ebiz:Item>
                  <ebiz:ItemId/>
                  <ebiz:Name/>
                  <ebiz:Description/>
                  <ebiz:UnitPrice>50.25</ebiz:UnitPrice>
                  <ebiz:Qty>2</ebiz:Qty>
                  <ebiz:Taxable>true</ebiz:Taxable>
                  <ebiz:TaxRate>0</ebiz:TaxRate>
                  <ebiz:UnitOfMeasure/>
                  <ebiz:TotalLineAmount>50.25</ebiz:TotalLineAmount>
                  <ebiz:TotalLineTax>10.00</ebiz:TotalLineTax>
                  <ebiz:ItemLineNumber>1</ebiz:ItemLineNumber>
                  <ebiz:GrossPrice>10</ebiz:GrossPrice>
                  <ebiz:WarrantyDiscount>2</ebiz:WarrantyDiscount>
                  <ebiz:SalesDiscount>0.5</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>true</ebiz:NotifyCustomer>
            <ebiz:EmailTemplateID/>
            <ebiz:URL/>
            <ebiz:TotalTaxAmount>5.25</ebiz:TotalTaxAmount>
            <ebiz:UniqueId/>
            <ebiz:Description/>
            <ebiz:BillingAddress>
               <ebiz:FirstName/>
               <ebiz:LastName/>
               <ebiz:CompanyName/>
               <ebiz:Address1/>
               <ebiz:Address2/>
               <ebiz:City/>
               <ebiz:State/>
               <ebiz:ZipCode/>
               <ebiz:Country/>
               <ebiz:IsDefault>false</ebiz:IsDefault>
               <ebiz:AddressId/>
            </ebiz:BillingAddress>
            <ebiz:ShippingAddress>
               <ebiz:FirstName/>
               <ebiz:LastName/>
               <ebiz:CompanyName/>
               <ebiz:Address1/>
               <ebiz:Address2/>
               <ebiz:City/>
               <ebiz:State/>
               <ebiz:ZipCode/>
               <ebiz:Country/>
               <ebiz:IsDefault>false</ebiz:IsDefault>
               <ebiz:AddressId/>
            </ebiz:ShippingAddress>
            <ebiz:CustomerMessage/>
            <ebiz:Memo/>
            <ebiz:ShipDate/>
            <ebiz:ShipVia/>
            <ebiz:SalesRepId/>
            <ebiz:TermsId/>
            <ebiz:IsToBeEmailed>false</ebiz:IsToBeEmailed>
            <ebiz:IsToBePrinted>false</ebiz:IsToBePrinted>
            <ebiz:SalesOrderCustomFields>
               <!--Zero or more repetitions:-->
               <ebiz:EbizCustomField>
                  <ebiz:FieldId/>
                  <ebiz:FieldCaption/>
                  <ebiz:FieldName/>
                  <ebiz:FieldValue/>
                  <ebiz:FieldType/>
                  <ebiz:FieldDataType/>
                  <ebiz:FieldDescription/>
               </ebiz:EbizCustomField>
            </ebiz:SalesOrderCustomFields>
            <ebiz:LocationId/>
         </ebiz:salesOrder>
      </ebiz:AddSalesOrder>
   </soapenv:Body>
</soapenv: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();
}
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;
}

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">
      <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>
<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/>
            <Status>Error</Status>
            <StatusCode>0</StatusCode>
            <Error>Adding Record error.  CustomerId not found</Error>
            <ErrorCode>3</ErrorCode>
         </AddSalesOrderResult>
      </AddSalesOrderResponse>
   </s:Body>
</s:Envelope>