gpt4 book ai didi

paypal - 来自安全 token 的 RETURNURL

转载 作者:太空宇宙 更新时间:2023-11-03 16:07:01 25 4
gpt4 key购买 nike

我在付费流链接上使用安全 token 。我成功地创建了一个具有以下值的 token 。

    setupParameters.put("CANCELURL", "http://localhost:9090/paypalcancel");
setupParameters.put("ERRORURL", "http://localhost:9090/paypalerror");
setupParameters.put("RETURNURL", "http://localhost:9090/paypalcompleted");
setupParameters.put("URLMETHOD", "POST");
setupParameters.put("TEMPLATE", "TEMPLATEB");
setupParameters.put("DISABLERECEIPT", "TRUE");

看起来 RETURNURL 正在工作,但它正在重定向到下面的 url。 https://payflowlink.paypal.com/http%3A%2F%2Flocalhost%3A9090%2Fpaypalcompleted

这给了我这个 http 错误 HTTP 错误 404 - 找不到文件。不足为奇,因为它没有访问我的网址。 ("http://localhost:9090/paypalcompleted ")

我在这里错过了什么?

提前致谢

保罗

最佳答案

好的,

所以问题出在使用 Apache 的 HTTPClient 上。它必须是 URLEncoding 参数。我转而使用标准的 Java URL 连接,它工作正常。我只需要手动制作参数字符串。

        URL obj = new URL(url);
HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("User-Agent", "Mozilla/5.0");
con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");

String urlParameters = "";
StringBuffer sb = new StringBuffer();
if(setupParameters!=null) {
for(String key : setupParameters.keySet()) {
sb.append(key+"="+setupParameters.get(key)+"&");
}
}
urlParameters=sb.toString().substring(0, sb.toString().length()-1);
// Send post request
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(urlParameters);
wr.flush();
wr.close();

int responseCode = con.getResponseCode();
System.out.println("\nSending 'POST' request to URL : " + url);
System.out.println("Post parameters : " + urlParameters);
System.out.println("Response Code : " + responseCode);

关于paypal - 来自安全 token 的 RETURNURL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37688442/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com