Qbms Connector

QBMS Connector is a pure Java wrapper around Intuit's QuickBooks Merchant Services [QBMS] API.

See:
          Description

Packages
com.intuit.qbmsconnector Provides most of the high-level client-facing functionality of the QBMS Connector API such as the QbmsConnector interface and the QbmsConfiguration class.
com.intuit.qbmsconnector.crypto Convenience classes for performing cryptographic operations.
com.intuit.qbmsconnector.jaxb Provides JAXB-based QbmsConnector functionality which "speaks" QBMSXML on your behalf.
com.intuit.qbmsconnector.jaxb.msgset.qbmsxml  
com.intuit.qbmsconnector.request Provides strongly-typed QBMS request objects.
com.intuit.qbmsconnector.response Provides strongly-typed QBMS response objects.
com.intuit.qbmsconnector.servlet Provides servlet support for handling callbacks POSTed by QBMS.
com.intuit.qbmsconnector.spring Spring Framework integration classes.
com.intuit.qbmsconnector.testing Contains test data [credit card numbers, error-inducing values] for use in the QBMS test environment only.
com.intuit.qbmsconnector.util Utility classes used internally by the QBMS Connector API.

 

QBMS Connector is a pure Java wrapper around Intuit's QuickBooks Merchant Services [QBMS] API. It abstracts away the low-level details of HTTPS plumbing, XML-to-Java marshalling/unmarshalling, and error handling.

There are two main pieces of the API that will be of interest to client programmers: QbmsConnector, an interface for sending QBMSXML requests and receiving responses, and QbmsCallbackListener, an interface that must be implemented to handle asynchronous callbacks from QBMS when events such as Merchant signups occur.

Here's some example code which shows how to make a credit card payment using QbmsConnector:

// Read in configuration properties from the classpath
QbmsConfiguration qbmsConfiguration = new QbmsConfiguration("/qbmsconnector.properties");

// Create a JAXB-backed QbmsConnector
QbmsConnector qbmsConnector = new JaxbQbmsConnector(qbmsConfiguration);

// Build a payment request...
CreditCardChargeRequest request = new CreditCardChargeRequest();
request.setCreditCardNumber("5555555555555555");
request.setNameOnCard("John Doe");
request.setExpirationMonth(12);
request.setExpirationYear(2014);
request.setAmount(130.00);

// ...define a connection ticket...
String connectionTicket = "TGT-XXX-XXXXXXXXXXXXXXXXXXXXXX";

// ...and make the payment.
try {
  CreditCardChargeResponse response = qbmsConnector.creditCardCharge(connectionTicket, request);
  System.out.println(response);
} catch (QbmsOperationException e) {
  System.out.println("Payment failed: " + e.getMessage());
}

If you execute the above code and your application has been correctly configured to communicate with QBMS, you'll see something like the following:

creditCardTransId=ME2034821203
authorizationCode=733952
avsStreet=NotAvailable
avsZip=NotAvailable
cardSecurityCodeMatch=NotAvailable
merchantAccountNumber=4269288763461315
reconBatchId=420070112 MC 2007-01-12 QBMS 17.0 pre-beta
paymentGroupingCode=4
paymentStatus=Completed
txnAuthorizationTime=Fri Jan 12 17:21:56 EST 2007
txnAuthorizationStamp=1168622516
clientTransId=q0004bb1

The above example references a qbmsconnector.properties file, which must exist on the classpath. This file has the following properties, which must be overridden on a per-application basis:

qbmsconnector.applicationLogin=firsttest.myapp.com
qbmsconnector.applicationId=123456789
qbmsconnector.environment=ptc
qbmsconnector.model=desktop
        

It should be noted that obtaining authorization from Intuit to communicate with QBMS is a prerequisite for using QBMS Connector. Your application will need to go through a registration process and generate its own keystore. Instructions for this are provided on the Intuit developer website.

Additionally, for Spring Framework integration, please see the QBMS Connector Spring package documentation.

QBMS Connector uses the Commons Logging API to log useful diagnostic information [raw QBMSXML that gets transferred, configuration property values, and so forth]. If your application uses log4j, you can add the following line to your log4j.properties file to view messages from QBMS Connector:

log4j.logger.com.intuit.qbmsconnector=DEBUG



Copyright © 2006-2010 Intuit Inc. All Rights Reserved.