【发布时间】:2017-01-10 01:37:01
【问题描述】:
我正在使用adaptivepayments api。获取paypal key的代码是,
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());
paykey成功返回,支付成功后,paypal页面应该显示给用户授权,沙箱链接是, (https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=paykey)
我正在做的敌人,
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();
paypal palpage 未显示,我可以在浏览器控制台中看到错误,"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=paykey"
geeting 错误,请求的资源上不存在“Access-Control-Allow-Origin”标头。因此不允许访问 Origin 'localhost:8080'。
请告诉我需要做什么才能重定向到贝宝页面。
谢谢, 盖伊特里
【问题讨论】:
-
您使用哪种语言?
-
你在用 chrome 试试吗?
-
是的,在 chrome 中尝试
标签: java paypal paypal-sandbox