I am using adaptivepayments api.The code to get paypal key is,
PayRequest payRequest = new PayRequest(requestEnvelope, "PAY_PRIMARY",
getProperties().getProperty("paypal_failed_url").trim() + bookingId, "SGD", receiverList,
getProperties().getProperty("paypal_success_url").trim() + bookingId);
payRequest.setFeesPayer("PRIMARYRECEIVER");
payRequest.setTrackingId(transactionKey);
payRequest.setReceiverList(receiverList);
AdaptivePaymentsService service = null;
Map<String, String> sdkConfig = new HashMap<String, String>();
sdkConfig.put("mode", "sandbox");
sdkConfig.put("acct1.UserName", "SG_Owner_api1.owner.com");
sdkConfig.put("acct1.Password", "WY8HAW6WGUNM3R72");
sdkConfig.put("acct1.Signature", "AFcWxV21C7fd0v3bYYYRCpSSRl31ATxmPR-EfTtPngimumXW80wNhGsQ");
sdkConfig.put("acct1.AppId", "APP-80W284485P519543T");
service = new AdaptivePaymentsService(sdkConfig);
PayResponse payResponse = null;
// ## Making API call
// Invoke the appropriate method corresponding to API in service
// wrapper object
payResponse = service.pay(payRequest);
logger.debug("-->" + payResponse.getPayKey());
logger.debug("-->" + payResponse.getResponseEnvelope().getAck());
The paykey is returned successfully, after that for the payment the paypal page should be shown for user's authorization and the sandbox link for that is , (https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=paykey)
Foe this I am doing ,
httpResponse.addHeader("Access-Control-Allow-Origin", "*");
httpResponse.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
httpResponse.addHeader("Access-Control-Allow-Headers",
"access-control-allow-origin,content-type, accept");
httpResponse.sendRedirect(url + payKey);
return Response.status(successResponse.getCode()).entity(successResponse).build();
The paypal palpage is not shown and I can see error in browser console,"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=paykey"
geeting error, No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'localhost:8080' is therefore not allowed access.
Please let me know what needs to be done to get redirected to paypal page.
Thanks, Gayithri