Illegal character in path at index 48: v1/payments/payment/PAY-7RS28472XP740142YLPMYPOA /execute
Nirosan
Member
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Oct-31-2018
04:05 AM
Hi,
I am using PayPal Java SDK to execute payment.
My code is look like this:
public Map<String, Object> completePayment(HttpServletRequest request) {
Map<String, Object> response = new HashMap<>();
logger.info("Payment ID: " + request.getParameter("paymentId"));
logger.info("Payer ID: " + request.getParameter("payerId"));
Payment payment = new Payment();
payment.setId(request.getParameter("paymentId"));
PaymentExecution paymentExecution = new PaymentExecution();
paymentExecution.setPayerId(request.getParameter("payerId"));
try {
logger.info("Payment Execution: " + paymentExecution.toJSON());
APIContext context = new APIContext(clientId, clientSecret, "sandbox");
Payment createdPayment = payment.execute(context, paymentExecution);
if(createdPayment != null){
response.put("status", "success");
response.put("payment", createdPayment);
}
} catch (PayPalRESTException e) {
// TODO Logger
logger.info("CompletePayment Exception: " + e.getDetails());
}
return response;
}
But the execute method of PaymentExecution throws java.net.URISyntaxException:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Illegal character in path at index 48: v1/payments/payment/PAY-7RS28472XP740142YLPMYPOA /execute] with root cause java.net.URISyntaxException: Illegal character in path at index 48: v1/payments/payment/PAY-7RS28472XP740142YLPMYPOA /execute at java.net.URI$Parser.fail(URI.java:2848) ~[na:1.8.0_91] at java.net.URI$Parser.checkChars(URI.java:3021) ~[na:1.8.0_91] at java.net.URI$Parser.parseHierarchical(URI.java:3105) ~[na:1.8.0_91] at java.net.URI$Parser.parse(URI.java:3063) ~[na:1.8.0_91] at java.net.URI.<init>(URI.java:588) ~[na:1.8.0_91] at java.net.URI.create(URI.java:850) ~[na:1.8.0_91] at java.net.URI.resolve(URI.java:1036) ~[na:1.8.0_91] at com.paypal.base.rest.RESTAPICallPreHandler.getEndPoint(RESTAPICallPreHandler.java:169) ~[rest-api-sdk-1.14.0.jar:na] at com.paypal.base.rest.PayPalResource.createHttpConfiguration(PayPalResource.java:457) ~[rest-api-sdk-1.14.0.jar:na] at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:293) ~[rest-api-sdk-1.14.0.jar:na] at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:228) ~[rest-api-sdk-1.14.0.jar:na] at com.paypal.api.payments.Payment.execute(Payment.java:226) ~[rest-api-sdk-1.14.0.jar:na]
I think it because of the space between paymentId and /execute:
v1/payments/payment/PAY-7RS28472XP740142YLPMYPOA /execute
then its an exception in
RESTAPICallPreHandler.java:169
Could you please help me?
How can I solve this problem?
Thany you
Labels:
- Labels:
-
SDK
0 REPLIES 0

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Compliance violation. flag based on the account origin ? in Sandbox Environment
- PayPal Redirection Issue After Successful Payment in Photobooth Integration in Sandbox Environment
- PayPal integration with Next, Lambda and API Gateway - 400 Invalid Request in Sandbox Environment
- Error creating an order for cupture - Issues with Authorization header in Braintree Server-side Integration (PHP, Java, .NET, Ruby, Python, NodeJS SDKs)
- add to cart button - product description - number of characters in PayPal Payments Standard