Home > Accounting, API General, Assessments, Payments, Void > SWS VoidTransaction Method

SWS VoidTransaction Method


Allows you to void a payment for a rental and/or retail items. A void can only be done the same day as the original transaction and prior to nightly processing.

Parameters

Name DataType Is Required
AccountID Long Required
Description The account’s ID number. This is returned when you use the CreateNewAccount method or can be retrieved with the SearchBy method.
AccountName String Required
Description The name on the account. This may differ from the primary contact’s name in some instances, such as a business account or a guardianship account.
Amount Decimal Required
Description The amount of the payment to be voided.
Ledger LedgerType Optional
Description Indicates if the transaction was for rental or retail.
Available values:

  • Rental
  • Retail
OrgID Long Required
Description The organization’s ID number.
SiteID Long Required
Description The site’s ID number. This can be found using the GetSiteList method.
TransactionDate DateTime Required
Description The date the transaction occurred. For a void transaction it must always have been done current day.
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. It can also be retrieved using the GetRentalLedger method.

Returned Parameters

Name DataType
Successful Boolean
Description Indicates if the transaction was voided successfully (“True”) or not (“False”).

Example

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 VoidTransaction request object, and a VoidTransaction response object. We can define and create those like this:

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

Here is a sample code of the request object:

// VoidTransaction Request
request.OrgID = 123456;
request.SiteID = 123546;
request.AccountID = 123456;
request.AccountName = "Doe, John";
request.Amount = 55.26m;
request.TransactionID = 123546;
request.TransactionDate = new DateTime(2016, 2, 3);
request.Ledger = SWS.LedgerType.Rental;

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
try
{
  response = service.VoidTransaction(user_request, request);
}
catch (Exception ex)
{
  MessageBox.Show(ex.Message);
}

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 )

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: