Home > Accounting, API General, Refunds, Retail/Merchandise > SWS GetRetailRefundAmount Method

SWS GetRetailRefundAmount Method


Retrieves a sum total refund amount for multiple retail item types and quantities.

Parameters

Name DataType Is Required
ReturnRetailData ReturnRetailItem Required
Description The object containing the details about the retail item/s being returned. Create a collection for each RetailObjectID being returned.
SiteID Long Required
Description The site’s ID number. This can be found using the GetSiteList method.
TransactionID Long Required
Description The transaction’s ID number. Transaction IDs are system generated for each payment transaction that occurs in the system. If there is no transaction ID the transaction failed. The transaction ID is returned when any MakePayment method is used.

Returned Parameters

Name DataType
TotalRefundAmount Decimal
Description The refund amount is automatically calculated by the Store application, based on the refund rules for the site.

Example

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

We’ll assume you’ve got a web reference, let’s name it SWS, in your Visual Studio project.  At this point we need to our objects.  We’ll need the standard service object, a GetRetailRefundAmount request object and a GetRetailRefundAmount response object.  You will also need a ReturnRetailItem(s) object to indicate which item you are returning. We can define and create those like this:

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

SWS.ReturnRetailItem item = new SWS.ReturnRetailItem();

Here’s my sample code of the Request object.

// GetRetailRefundAmount Request
item.RetailObjectID = 123456;
item.Quantity = 1;
item.ReturnReason = SWS.RetailReturnReasons.DEFECTIVE_DESTROY;

request.SiteID = 123456;
request.TransactionID = 123456;
request.ReturnRetailData = new SWS.ReturnRetailItem[] { item };

Finally we can call the method and pass across the login object and the request object to get our retail refund amount. It’s a good idea to do this in a Try Catch block.

// Call the method that will load the response object
try
{
  response = service.GetRetailRefundAmount(user_request, request);
}
catch (Exception ex)
{
  MessageBox.Show(ex.Message);
}

Note that if something goes wrong the service will respond with an exception. You’ll want to take a look at that message returned in that exception so it can be debugged.

For a full list of methods see SWS Methods.

  1. swsBecky
    April 6, 2017 at 7:45 am

    Updated May 7, 2013: The GetRetailRefundAmount method has been updated so that it will now validate the quantity of the items that you are attempting to return, to the given transaction. If the items were either previously returned or the return quantity is greater than the purchased quantity on the original transaction an ApplicationException will now be thrown.

  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 )

Google photo

You are commenting using your Google 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

%d bloggers like this: