Create a Config object and set API configuration parameters

Note that ipcApiUrl is different for sandbox and production environment

You can set RSA keys for request signatures by setting key content using loadPrivateKeyFromString and loadPublicKeyFromString or by setting file path using loadPrivateKeyFromFile and loadPublicKeyFromFile

For more information please refer to myPOS Checkout API Documentation


import com.mypos.myposcheckout.ipc.Config; 
import com.mypos.myposcheckout.ipc.IPCException; 

// ... 

Config cnf = new Config(); 

URL ipcApiUrl = null; 
try { 
    ipcApiUrl = new URL(""); 
} catch (MalformedURLException ex) { 
    // Handle the malformed URL exception 

cnf.loadPrivateKeyFromFile("path_to_directory/storePrivateKey.pem"); // Replace `path_to_directory` with the actual file path 
cnf.loadPublicKeyFromFile("path_to_directory/apiPublicKey.pem"); // Replace `path_to_directory` with the actual file path 

Create a Response object with the incoming POST data.
This will validate the income data and the request signature.

import com.mypos.myposcheckout.ipc.IPCException; 
import com.mypos.myposcheckout.ipc.enumerable.CommunicationFormat; 
import com.mypos.myposcheckout.ipc.response.BasicResponse; 

// ... 

try { 
    // `postPayload` should contain the POST request body 
    BasicResponse notification = new BasicResponse(cnf, postPayload, CommunicationFormat.POST); 
} catch (IPCException ex) { 
    // Error 

Get the posted data as a Map<String, String>
the response data contains elements with keys: IPCmethod, SID, Amount, Currency, OrderID, IPC_Trnref, RequestSTAN,RequestDateTime

getDataNormalized() returns the response data with lowercase keys.

Merchant site must have next logics:

1. Search in DB for order with this OrderID

2. Verify that Amount and Currency match to amount from the original transaction

3. Show "Your order has been canceled" page to the merchant customer

import java.util.Map; 

import com.mypos.myposcheckout.ipc.Constants; 

// ... 

Map<String, String> notificationData = notification.getDataNormalized(); 
if (/* ... order is found in merchant store DB */) { 
    // Display "Your order has been canceled" for example 
} else { 
    // Display Some general error or redirect to merchant store home page