Paypal Transparent Redirect RETURNURL post parameters

元气小坏坏 提交于 2019-12-08 12:06:02

问题



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.

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

Thanks again, Tony


回答1:


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&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

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>



回答2:


It should work as I tested in my test environment and it worked for me . But I passed the length tag with each of the parameter in the request while creating the secure token and did the encoding for "&" . Like below :

ERRORURL[86]=https://www.somesite.com/site.w?location=results.w%26parameter1=value1%26parameter1=value1 CANCELURL[86]=https://www.somesite.com/site.w?location=results.w%26parameter1=value1%26parameter1=value1 RETURNURL[86]=https://www.somesite.com/site.w?location=results.w%26parameter1=value1%26parameter1=value1

See the attached image too :



来源:https://stackoverflow.com/questions/29568274/paypal-transparent-redirect-returnurl-post-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!