Merchant Applications Documentation

Regardless of which programming language you are using, the architecture of the SDK is the same.  

Each request to the [Base Commerce Merchant / Reseller Application] begins by initializing the BaseCommerceClient object, then creating a MerchantApplication object.

BaseCommerceClient o_client = new BaseCommerceClient(XS_USERNAME, XS_PASSWORD, XS_KEY);
MerchantApplication o_merchant_application = new MerchantApplication();

Once you have created your client, you will then create the objects that represent your Merchant Application. These objects, which will be discussed more in detail on the following pages. Below is a diagram displaying the relationship between all of the objects.

merchant-application-document.png

After creating and setting up your objects, it takes just one function call to the client to submit your application.

List<MerchantApplication> o_merchant_applications = o_client. submitApplication( o_merchant_application );

Now, to check if our example merchant application was accepted or not, we would take a look at the response code on each returned MerchantApplication object. The submitApplication method will return a List of MerchantApplications, one for each Location object sent in with the request.

for ( MerchantApplication o_merchant_app : o_merchant_applications ) {
if( o_merchant_application.getResponseCode() == 200 ) {
             // Successful application submission
} else if( o_merchant_application.getResponseCode() == 600 ) {
for( String s_field : o_merchant_application.getResponseMessages().keySet() )  {
             String s_message = o_merchant_application.getResponseMessages().get( s_field);
             // Handle error
}
}

This completes the process of submitting a Merchant Application and checking the response. In the event you are processing multiple applications, the same client object can be reused multiple times; however, a new MerchantApplicaiton object should be created with each request. When you are done with the client, there is no clean up to do, as all resources are closed and variables reset after each application is processed.

In the event that the server is unable to process your request due to a communication issue, a MerchantApplicationClientException will be thrown.