Help: Support, Samples
Documentation: User Guide
Continuous Integration:
Maven:
License:
This Payments SDK provides a Java library that make it easier to call QuickBooks Online Payments API. This library supports the following APIs:
- Token creation for card and bankAccount.
- BankAccount functions like create, delete, retrieve.
- Card functions like create, delete, retrieve.
- Charge functions like create, capture, retrieve, refund.
- ECheck functions like create retrieve, refund.
In addition to the above, the library also supports, logging, error handling, serialization/deserialization and capturing intuit_tid for easier debugging. Note: This library works only for OAuth2 apps.
The SDK works on JDK 1.6 and above.
The SDK can be installed using one of the ways below-
-
Download the latest version of the jar from maven and add it to your projects classpath
payment-api.jar
-
Add the following dependency to the build.gradle file. Make sure to use the latest version of the SDK found here
compile("com.intuit.quickbooks-online:payments-api:5.0.0")
-
Add the following dependency to the pom.xml file. Make sure to use the latest version of the SDK found here
<dependency> <groupId>com.intuit.quickbooks-online</groupId> <artifactId>payments-api</artifactId> <version>5.0.0</version> </dependency>
- Create the RequestContext object as shown below. Pass in the accessToken and Environment.
RequestContext requestContext = new RequestContext.Builder(accessToken, Environment.SANDBOX).build();
The above code automatically sets a unique requestid as well. To provide your custom requestid use the below code-
RequestContext requestContext = new RequestContext.Builder(accessToken, Environment.SANDBOX)
.requestId(requestId).build();
You can also set Proxy parameters in the same way.
- Create the Service object. The sample below shows how to create a TokenService, you can create other service objects - Echeck, Charge, Card, BankAccount in the same way.
TokenService tokenService = new TokenService(requestContext);
- Prepare Token request create token for a credit card
Address address = new Address.Builder().region("CA").postalCode("94086")
.streetAddress("1130 Kifer Rd").city("Sunnyvale")
.country("US").build();
Card card = new Card.Builder().expYear("2020").expMonth("02").address(address)
.name("emulate=0").cvc("123")
.number("4111111111111111").build();
Token tokenRequest = new Token.Builder().card(card).build();
- Call the TokenService to create token
Token token = tokenService.createToken(tokenRequest);
- Retrieve token value
token.getValue();
Makes sure to log intuit_tid and requestId for each of your request for easier debugging
For logging intuit_tid, use the following method
token.getIntuit_tid();
For logging requestId, use the following method
token.getRequestId();
For more samples on how to create other entities and operation, take a look at the sample application below :
sample