Merits and Demerits
After version 2.7.8, J2pay now support Authorize and Capture transactions.
Below is the list of all the transaction types supported now.
- Purchase (Authorize + Capture in one step)
If all of your transactions are based on Cards and you are interested in six methods listed above then this library is built for you.
At the same time this library provides generic request/response for all gateways. As you know some gateways accept xml while some are JSON or query string. This library always accept and return JSON and do all the casting internally.
Before You Begin
In this section we will discuss about what you should know before working on this library. Every gateway is this library accept and return JSON. Since JSON is not directly supported by java we will be using org.json package which have number of classes to deal with JSON.
As you know any library has collection of classes and interfaces so before working on this library it is highly recommended that you should understand its classes and methods.
- Gateway, is the top level abstract class all gateways must be inheriting this class.
- GatewayFactory, will be responsible for returning the required gateway.
- HTTPResponse, gateway response will be returning this class's object instead of plain text or JSON.
- JSONObject, Represent the JSON data also will be using for posting dynamic gateway data.
- AvailableGateways, enum contains the list of supported gateways. We will be passing this to GatewayFactory to get the desired gateway class object.
In the beginning we read this library has a built-in documentation, now it’s time to understand what was that mean. This Library provided sample parameter methods for all gateways which let know what the required parameters for that gateway are.
Sample parameter methods are the most important part of this library, these are responsible for providing you the gateway specific parameters with short description that also excludes the reading of gateway documentation.
Below is the list of methods. All of these methods returns ready to use JSON with short description. You can just populate the values and pass to another methods.
This method is the key for all API requests, all gateways required some authentication parameters for example some required username and password while some required transaction key. This method returns the gateway specific parameters.
Note: Rest of the methods work similar as you can identify by their name.