A payment service provider (PSP) offers shops online services for accepting electronic payments by a variety of payment methods including credit card, bank-based payments such as direct debit, bank transfer, and real-time bank transfer based on online banking. Typically, they use a software as a service model and form a single payment gateway for their clients (merchants) to multiple payment methods. read more
- Fondy account
- Java 8
If Maven project, add sdk dependency in section:
<dependencies>
<dependency>
<groupId>com.cloudipsp.cloudipspsdk</groupId>
<artifactId>java-cloudipsp-sdk-client</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>public class Main {
public static void main(String[] args) {
final Configuration config = new Configuration()
.setSecretKey("test")
.setMerchantId(1396424);
client = new CloudIpspApi(config);
pamentApi = client.getPaymentApi(); // Get payment api instance
orderApi = client.getOrderApi(); // Get api instance for working with orders
/**
* Generate payment request
*/
JSONObject payload = new JSONObject();
payload.put("currency", "EUR");
payload.put("amount", 100);
payload.put("order_id", "test123");
BaseApiResponse response = pamentApi.paymentUrl(payload);
JSONObject order = response.getParsedResponse();
URI checkout_url = response.getCheckoutUrl();
/**
* Generate capture request
*/
JSONObject payload = new JSONObject();
payload.put("currency", "EUR");
payload.put("amount", 100);
payload.put("order_id", "test123");
BaseApiResponse response = orderApi.Capture(payload);
JSONObject order = response.getParsedResponse();
}
}response will be an object with the following getters:
getStatus()- int HTTP status codegetResponse()- the response serialized into a JSONObjectgetRawResponse()- the raw JSON String response bodygetParsedResponse()- the response serialized into a JSONObject and converted by versiongetUrl()- the URL for the REST call the SDK calls, for troubleshooting purposesgetRawRequest()- the JSON request body String sentgetRetries()- usually 0, but reflects the number of times a request was retried due to throttling or other server-side issuegetDuration()- duration in milliseconds of SDK function callisSuccess()- returns true for a 200getReportList()- the response serialized into a JSONList used by getting reportsgetCheckoutUrl()- return URI