Simple transaction
- Create WirecardClient instance. Note that our SDK works only with non-rooted devices, if SDK detects that device is rooted, exception is thrown during initialization of WirecardClient object. This is how you should handle this: 
WirecardClient wirecardClient;
String environment = WirecardEnvironment.TEST.name();
try {
    wirecardClient = WirecardClientBuilder.newInstance(context, environment)
                    .build();
} catch (WirecardException exception) {
    
}
 
- Create and initialize WirecardPayPalPayment object: 
WirecardPayPalPayment wirecardPayment = new WirecardPayPalPayment(timestamp, requestID, merchantID, transactionType, amount, currency, signature);
 
- Create and initialize WirecardResponseListener object which provides callback methods which will provide transaction result or error information if occure. 
WirecardResponseListener wirecardResponseListener = new WirecardResponseListener() {
    @Override
    public void onResponse(WirecardPaymentResponse paymentResponse) {
        
        if (paymentResponse.getTransactionState().equals(TransactionState.SUCCESS)) {
            
        } else {
            
        }
    }
    @Override
    public void onError(WirecardResponseError responseError) {
        
        switch (responseError.getErrorCode()) {
            case WirecardErrorCode.ERROR_CODE_GENERAL:
                String detailedMessage = responseError.getErrorMessage();
                
                break;
            case WirecardErrorCode.ERROR_CODE_INVALID_PAYMENT_DATA:
                
                break;
            case WirecardErrorCode.ERROR_CODE_NETWORK_ISSUE:
                
                break;
            case WirecardErrorCode.ERROR_CODE_USER_CANCELED:
                
                break;
        }
    }
};
 
- Call WirecardClient’s method makePayment: 
wirecardClient.makePayment(wirecardPayPalPayment, wirecardResponseListener, paymentPageStyle);
 
- Process response. When transaction was processed on server side and no error during transaction occurred, WirecardResponseListener’s method onResponse will be called. If any error occurs, method onError will be called:
 
Recurring transaction
If you want to perform recurring transaction, just set Periodic object into wirecardPayPalPayment object instance. 
Periodic periodic = new Periodic(periodicType, sequenceType);
wirecardPayPalPayment.setPeriodic(periodic);