A Java library to integrate with eWAY's Rapid Payment API.
Sign up with eWAY at:
- Australia: https://www.eway.com.au/
- New Zealand: https://eway.io/nz/
- Hong Kong: https://eway.io/hk/
- Malaysia: https://eway.io/my/
- Singapore: https://eway.io/sg/
For testing, get a free eWAY Partner account: https://www.eway.com.au/developers
The eWAY Rapid Java library can be easily added to your Maven project's pom.xml:
<dependency>
<groupId>com.ewaypayments</groupId>
<artifactId>eway-rapid-java</artifactId>
<version>1.4.0</version>
</dependency>
The eWAY Rapid Java library can also be built with Maven. To do so:
- Clone the eWAY Rapid GitHub project or download the zip
- Navigate to the folder with the pom.xml file and run
$ mvn package
- The compiled jar file will be in the "target" directory
See the eWAY Rapid API Reference for usage details.
A simple Direct payment example:
import com.eway.payment.rapid.sdk.*;
import com.eway.payment.rapid.sdk.beans.external.*;
import com.eway.payment.rapid.sdk.output.*;
public class EwayRapid {
public static void main(String[] args) {
String apiKey = "Rapid API Key";
String password = "Rapid API Password";
String rapidEndpoint = "Sandbox";
RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);
CardDetails cardDetails = new CardDetails();
cardDetails.setName("John Smith");
cardDetails.setNumber("4444333322221111");
cardDetails.setExpiryMonth("12");
cardDetails.setExpiryYear("25");
cardDetails.setCVN("123");
Customer customer = new Customer();
customer.setCardDetails(cardDetails);
PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);
Transaction transaction = new Transaction();
transaction.setCustomer(customer);
transaction.setPaymentDetails(paymentDetails);
transaction.setTransactionType(TransactionType.Purchase);
PaymentMethod method = PaymentMethod.Direct;
CreateTransactionResponse response = client.create(method, transaction);
if (response.getTransactionStatus().isStatus()) {
System.out.println("Transaction successful! ID: " + response.getTransactionStatus().getTransactionID());
}
}
}
Please see CHANGELOG for more information what has changed recently.
Tests are written with JUnit and can be run using Maven:
$ mvn test
The MIT License (MIT). Please see License File for more information.