本文介绍了Paypal 透明重定向 RETURNURL 帖子参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


目前正在尝试使用 Paypal 实现透明重定向,但无法获取包含我正在设置的参数的返回 url.看来贝宝正在从 returnurl 查询字符串中删除参数,因此我的网站在重定向后无法正常运行.我的顺序如下:

1- 向 Paypal 发出安全令牌请求,将 returnurl 和 errorurl 作为令牌请求的一部分传递.
2- 在我的表单中嵌入从贝宝获得的安全令牌值(直接发布到贝宝).
3- Paypal 重定向回 returnurl 但缺少参数....试图重定向回 https://www.somesite.com/site.w?location=results.w&parameter1=value1 但我改为重定向到 https://www.somesite.comt/site.w?location=results.w(缺少参数 1=值 1).

我已经尝试对 returnurl 进行 url 编码,因此对与符号和问号进行了编码,但根据返回 url 中的贝宝文档值,不会进行编码.


Currently trying to implement transparent redirect with Paypal but unable to get the return url to contain the parameters I am setting. Appears that paypal is stripping out the parameters from the returnurl querystring and as such my site is not behaving properly after the redirect. My sequence is as follows:

1- Make a secure token request to Paypal passing the returnurl and errorurl as part of the token request.
2- Embed the secure token value obtained from paypal within my form (which posts directly to paypal).
3- Paypal redirects back to the returnurl but the parameters are missing....attempting to redirect back to https://www.somesite.com/site.w?location=results.w&parameter1=value1 but am instead redirected to https://www.somesite.comt/site.w?location=results.w (missing the parameter1=value1).

I have tried url-encoding the returnurl so the ampersands and question mark are encoded but as per the paypal documentation values in the return url are not to be encoded.

有谁知道如何在 paypal 重定向期间让 returnurl 包含正确的 GET 参数?

Does anyone know how I can get the returnurl to contain the proper GET parameters during the paypal redirect?

再次感谢,托尼

推荐答案

只是为了跟进....好的,因此对与符号 (& -> %26) 进行编码并将长度添加到 RETURNURL 参数确实有效并且确实如此尽管浏览器在重定向时没有正确解释 url,但仍传递该值.我再次尝试没有对&符号进行编码,但保持 RETURNURL 的长度不变,并且在重定向时保留了 url 参数!所以我的最终解决方案是一个包含 RETURNURL 的安全令牌请求,其中包含长度特征,以便 Paypal 可以正确解析 returnurl 值(维护查询字符串参数).示例如下:

Just to follow up....Ok so encoding the ampersand (& -> %26) and adding the length to the RETURNURL parameter did work and did pass the value although the browser did not properly interpret the url upon redirect. I tried again without encoding the ampersands but kept the length of the RETURNURL intact and the url parameters were preserved upon redirect! So my final solution would be a secure token request containing the RETURNURL which contains the length feature so that Paypal can properly parse the returnurl value (maintaining the querystring parameters). Example as follows:

/opt/pware/bin/curl -s -S -k --connect-timeout 30 --max-time 120 -H "X-VPS-CLIENT-TIMEOUT:45" -d "PARTNER=PayPal&VENDOR=somevendor&USER=someuser&PWD=somepassword&TENDER=C&CREATESECURETOKEN=Y&SECURETOKENID=0000050&SILENTTRAN=TRUE&rm=2&TRXTYPE=A&AMT=40.00&23]URLhttps://somesite.com/cgi-bin/test/site.w?location=b2c/retail-checkout.w&frames=no&target=main&lang=en-US" rel="nofollow">https://somesite.com/cgi-bin/test/site.w?location=b2c/retail-checkout.w&frames=no&target=main&lang=en-US" https://pilot-payflowpro.paypal.com

/opt/pware/bin/curl -s -S -k --connect-timeout 30 --max-time 120 -H "X-VPS-CLIENT-TIMEOUT:45" -d "PARTNER=PayPal&VENDOR=somevendor&USER=someuser&PWD=somepassword&TENDER=C&CREATESECURETOKEN=Y&SECURETOKENID=0000050&SILENTTRAN=TRUE&rm=2&TRXTYPE=A&AMT=40.00&RETURNURL[123]=https://somesite.com/cgi-bin/test/site.w?location=b2c/retail-checkout.w&frames=no&target=main&lang=en-US" https://pilot-payflowpro.paypal.com

对于想知道获得安全令牌后该怎么做的其他人,只需将令牌嵌入您的表单中,并且 returnurl 应包含正确的参数....这里有一个示例静态 html 页面,您可以使用它来测试您的安全令牌/安全令牌 ID 组合:

For anyone else wondering what to do once you obtain the secure token simply embed the token in your form and the returnurl should contain the proper parameters....heres a sample static html page which you can use for testing the post of your secure token/ secure token ID combo:

<html>
<head>
</head>
<body>
<form id="form" method="POST" action="https://pilot-payflowlink.paypal.com">
<input type="hidden" id="SILENTTRAN" name="SILENTTRAN" value="true"/>
<input type="hidden" id="CURRENCY" name="CURRENCY" value="USD"/>
<input name="VERBOSITY" type="hidden" value="HIGH">
<input type="hidden" name="rm" value="2">
<!--<input name="MODE" type="hidden" value="TEST">-->
<p>SECURETOKEN</p><input type="text" id="SECURETOKEN" name="SECURETOKEN" />
<p>SECURETOKENID</p><input type="text" id="SECURETOKENID" name="SECURETOKENID" />
<p>Address:</p><input type="text" id="BILLTOSTREET" name="BILLTOSTREET" value="123 Test"/>
<p>Zip:</p><input type="text" id="BILLTOZIP" name="BILLTOZIP" value="90210"/>
<p>AMOUNT:</p><input type="text" id="AMT" name="AMT" value="33.00"/>
<p>CSC:</p><input name="CVV2" type="text" value="123">
<p>TRXTYPE:</p><input type="text" id="TRXTYPE" name="TRXTYPE" value="S">
<p>Card Number:</p><input type="text" id="ACCT" name="ACCT" maxlength=16 value="4111111111111111">
<p>Expiry MONTH:</p><input type="text" id="EXPMONTH" name="EXPMONTH" maxlength=2 value="01">
<p>Expiry YEAR:</p><input type="text" id="EXPYEAR" name="EXPYEAR" maxlength=2 value="16">
<input type="submit" value="Submit">
</form>
</body>
</html>

这篇关于Paypal 透明重定向 RETURNURL 帖子参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:52