Home > API General, Retail/Merchandise > SWS SellRetailWithAccount Method

SWS SellRetailWithAccount Method

Creates a retail assessment and attaches it to an account. Once you have a response, you will need to call the GetTotalDue method. This will provide the total amount that needs to be paid using the MakePayment method.


Name DataType Is Required
AccountID Long Required
Description The account’s ID number to which the retail will be attached. This is returned when you use the CreateNewAccount method or can be retrieved with the SearchBy method.
Description The object containing the required item information.
Quantity Integer Required
Description The total number of items to be sold.
TaxExemptNumber String Optional
Description If the company or individual is tax exempt, enter their tax ID number here.

Returned Parameters

Name DataType
AssessmentID Long
Description An assessment ID is created for every assessment set up in store.


As with every method we need to pass in credentials. We do this with the LookupUser request object.

We will assume you have a web reference, let us name it SWS, in your Visual Studio project. At this point we need to define our objects.  We will need the standard service object, a SellRetailWithAccount request object, and a SellRetailWithAccount response object. We will also need a response from the GetAvailableRetailItems method. We can define and create those like this:

// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.SellRetailWithAccount_Request request = new SWS.SellRetailWithAccount_Request();
SWS.SellRetailWithAccount_Response response;

SWS.GetAvailableRetailItems_Request retailItemReq = 
                                 new SWS.GetAvailableRetailItems_Request();

Here is a sample code of the request object:

// SellRetailWithAccount Request
retailItemReq.SiteID = 123456;

request.AccountID = 123456;
request.Quantity = 2;
request.Item = service.GetAvailableRetailItems
                          (user_request, retailItemReq).Details[0];

Finally we can call the method and pass across the login object and the request object to retrieve our requested information. It’s a good idea to do this in a Try Catch block.

// Call the method that will load the response object
  response = service.SellRetailWithAccount(user_request, request);
catch (Exception ex)

Note that if something goes wrong the service will respond with an exception. You will want to capture the message in the exception so it can be debugged.

For a full list of methods see SWS Methods.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s