Package de.firstdata.ipg.api.client

To perform a transaction you need the IPGApiClient and the IPGApiTransactionFactory or to perform a action you need the IPGApiActionFactory.

Connect the web service with the Java-IPGApiClient

First you need an instance of IPGApiClient. This class manages the connection to the webservice, builds the XML and the SOAP message and evaluates the response. To compose a transaction or to evaluate the response, you work with simple classes like Java Beans.

To instance an IPGApiClient

There are several constructors to instantiate the IPGApiClient. The simples constructor should be work, if you have Sun Java 5 or higher and your user id is 1. Example:

The instantiation of the IPGApiClient:


String url = "https://test.ipg-online.com/ipgapi/services";
String storeId = "your store id";
String password = "your password";
byte[] key = de.firstdata.common.utils.IO.getBytes("/path/to/your/keyStore.jks");
String keyPW = "your key store password";

IPGApiClient client = new IPGApiClient(url, storeId, password, key, keyPW);

To send a transaction and evaluate the response

For all transactions with the credit card, the german direct debit and the UK debit card are different classes in the API. You can take the factory class de.firstdata.ipgapi.client.IPGApiTransactionFactory to generate the class you need.
In this example we will make a credit card sale transaction with 7 €.


Amount amount = new Amount("7", "978"); // ISO 4217: EUR = 978
CreditCard cC = new CreditCard("1111222233334444", "07", "17", null);
CCSaleTransaction transaction = IPGApiTransactionFactory.createSaleTransactionCredit(amount, cC);
// some transaction can includes further information e.g. the customer
transaction.setName("a name");
// ...
try {
        IPGApiResult result = client.commitTransaction(transaction);
        // now you can read the conclusion
        System.out.println(result.getOrderId());
        System.out.println(result.getTransactionTime());
        // ...
} catch (ProcessingException e) {
        // ERROR: transaction not passed
}

This example is a card not present transaction. If you want to make a card present transaction, the fourth parameter of the constructor CreditCard must be filled with the card code value.