2015-10-02 101 views
0

我使用paypal rest API在java web应用程序中使用paypal express checkout方法处理付款,目前应用程序指向paypal沙箱。当重定向到PayPal网站供用户认可,始终得到一个页面,说我们是没有问题的测试事务,直到最近却突然它现在没有工作,没有做任何编码的改变也,PayPal交易已过期

现在

This transaction has expired. Please return to the recipient's website to complete your transaction using their regular checkout flow 

We're sorry, but your session has ended. Your account hasn't been charged. Please go back to the merchant's site and check out again with PayPal. 

我得到在java中的重定向URL(批准URL)为波纹管

private String getApprovalURL(Payment payment) 
     throws UnsupportedEncodingException { 
    String redirectUrl = null; 
    List<Links> links = payment.getLinks();  
    for (Links l : links) { 
     if (l.getRel().equalsIgnoreCase("approval_url")) { 
      redirectUrl = URLDecoder.decode(l.getHref(), "UTF-8"); 
      break; 
     } 
    } 
    return redirectUrl; 
} 

和我得到重定向类似于下面的网址,

https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-6U3345417C9052027 

这可能是导致此行为的原因?有什么建议么?

谢谢。

回答

2

我们也遇到过这个问题。我们通过修改我们从PayPal回调中收到的返回网址来解决此问题,并在重定向之前明确将​​添加到网址中。

实际的URL获得: https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-6U3345417C9052027

修改后的URL: https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-6U3345417C9052027

+0

这工作的感谢,但我想知道什么是对这个问题的原因,因为这是工作的罚款 – Lakmal