I am trying to use adaptive payment api from paypal java sdk and calling getPaymentExecStatus() giving null. This is my code
final PayRequest payRequest = new PayRequest();
final List<Receiver> receivers = new ArrayList<Receiver>();
final Receiver receiver = new Receiver();
receiver.setAmount(ammount);
receiver.setEmail("[email protected]");
receivers.add(receiver);
final ReceiverList receiverList = new ReceiverList(receivers);
payRequest.setSenderEmail(Constants.PAYPAL_USER_ID);
payRequest.setReceiverList(receiverList);
final RequestEnvelope requestEnvelope = new RequestEnvelope("en_US");
payRequest.setRequestEnvelope(requestEnvelope);
payRequest.setActionType("PAY");
payRequest.setCancelUrl("https://devtools-paypal.com/guide/ap_implicit_payment?cancel=true");
payRequest.setReturnUrl("https://devtools-paypal.com/guide/ap_implicit_payment?success=true");
payRequest.setCurrencyCode("USD");
payRequest.setIpnNotificationUrl("http://replaceIpnUrl.com");
final Map<String, String> sdkConfig = new HashMap<String, String>();
sdkConfig.put("mode", Constants.PAYPAL_MODE);
sdkConfig.put("acct1.UserName", Constants.PAYPAL_USER_ID);
sdkConfig.put("acct1.Password", Constants.PAYPAL_USER_PASSWORD);
sdkConfig.put("acct1.Signature",Constants.PAYPAL_USER_SIGNATURE);
sdkConfig.put("acct1.AppId",Constants.PAYPAL_APPID);
Logger.debug("paypal"+Constants.PAYPAL_USER_ID+Constants.PAYPAL_USER_PASSWORD+Constants.PAYPAL_USER_SIGNATURE);
final AdaptivePaymentsService adaptivePaymentsService = new AdaptivePaymentsService(sdkConfig);
try {
final PayResponse payResponse = adaptivePaymentsService.pay(payRequest);
Logger.error("error list"+payResponse.getError());
Logger.debug("pay respose"+payResponse.toString());
coachWithdrawl.withdrawlAmount = ammount;
Logger.debug("payResponse"+payResponse.getPaymentExecStatus());
coachWithdrawl.paymentExecStatus = payResponse.getPaymentExecStatus();
coachWithdrawl.payKey = payResponse.getPayKey();
payResponse.getPaymentExecStatus();
} catch (SSLConfigurationException | InvalidCredentialException | HttpErrorException
| InvalidResponseDataException | ClientActionRequiredException | MissingCredentialException
| IOException | InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (final com.paypal.sdk.exceptions.OAuthException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I took example from here paypal implicite example and its in sandbox mode so I get credentials from dashboard account tab. please help me to find why the response and other data comming is null.thanks in advance..
By mistake ,I used paypal user id as the sender id , so it was giving null to get Execution status.thanks though.