Java SDK for interacting with the Worldpay Developer REST API.
Please see our support contact information to raise an issue.
Please download lastest released jar from release section. This jar does not require any other dependency.
https://online.worldpay.com/docs
https://online.worldpay.com/api-reference
Initialize the REST client with the default URL and the specified service key and then use the required service:
WorldpayRestClientrestClient = newWorldpayRestClient("YOUR_SERVICE_KEY");
OrderRequestorderRequest = newOrderRequest();
orderRequest.setToken("valid-token");
orderRequest.setAmount(1999);
orderRequest.setCurrencyCode(CurrencyCode.GBP);
orderRequest.setName("test name");
orderRequest.setOrderDescription("test description");
try {
OrderResponseorderResponse = restClient.getOrderService().create(orderRequest);
System.out.println("Order code: " + orderResponse.getOrderCode());
} catch (WorldpayExceptione) {
System.out.println("Error code: " + e.getApiError().getCustomCode());
System.out.println("Error description: " + e.getApiError().getDescription());
System.out.println("Error message: " + e.getApiError().getMessage());
}Alternatively, the client can also be initialized with the REST service URL as well as the service key e.g.
WorldpayRestClientrestClient = newWorldpayRestClient("https://api.worldpay.com/v1", "YOUR_SERVICE_KEY");Use following API to get the Current SDK Library Version (available in v1.8 onwards only) in use:
WorldpayRestClientrestClient = newWorldpayRestClient("YOUR_SERVICE_KEY");
StringworldpaySdkVersion = restClient.getVersion();