Paypal BuyNow-使用returnUrl参数的GET而不是POST [英] Paypal BuyNow - GET instead of POST with params for returnUrl

查看:68
本文介绍了Paypal BuyNow-使用returnUrl参数的GET而不是POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个今天发现的问题.我有以下Paypal按钮配置:

 <form action="https://www.paypal.com/cgi-bin/webscr" method="post" i d="paypalFormId">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="mybusinessID">
    <input type="hidden" name="lc" value="DE">
    <input type="hidden" name="button_subtype" value="services">
    <input type="hidden" name="no_note" value="1">
    <input type="hidden" name="no_shipping" value="2">
    <input type="hidden" name="item_name" value="MyProductName">
    <input type="hidden" name="amount" value="1.00">
    <input type="hidden" name="custom" value="somecustom infos needed in the redirection">
    <input type="hidden" name="rm" value="2">
    <input type="hidden" name="return" value="https://myreturnurl.com">
    <input type="hidden" name="cancel_return" value="https://mycancelurl.com">
    <input type="hidden" name="currency_code" value="EUR">
    <input type="hidden" name="notify_url" value="myIPNUrl">
    <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
    <div class="row">
       <button type="submit" class="btn btn-submit-next pull-right">Bestellung abschließen</button>
    </div>
 

在过去的几天里,我没有改变任何可能影响此代码的内容,但是,缺少重定向POST参数,即使使用rm = 2,重定向也是现在的GET而不是POST方法!

任何想法,这是怎么回事?

最诚挚的问候,

Antoine

我能够在JSFiddle上隔离问题:如果删除item_name输入,那么它将起作用.我不知道为什么,但是也许它可以帮助您告诉我我做错了!

解决方案

我们遇到了同样的问题. 您需要启用"PDT",然后自定义字段将在返回网址文章的"cm"变量中返回.

还需要启用自动返回"才能使用"PDT",但是如果需要动态设置,您仍可以在按钮表单中而不是在自动返回"配置中设置返回URL.

https://developer.paypal.com/docs/经典/产品/付款数据传输/

尝试使用此沙盒付款按钮,看看响应记录在返回URL上时的样子.

 <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick"><input type="hidden" name="amount" value="0.67">
<input type="hidden" name="cancel_return" value="http://test.smsportal.co.za/onlinePaymentv2/Testing3rdPartyResponse.aspx"> 
<input type="hidden" name="custom" value="this is the custom variable. it is named 'cm' in the returned Url."> 
<input type="hidden" name="return" value="http://test.smsportal.co.za/onlinePaymentv2/Testing3rdPartyResponse.aspx"> 
<input type="hidden" name="rm" value="2"> 
<input type="hidden" name="cbt" value="Return to Merchant"> <input type="hidden" name="business" value="paypalmerchant@smsportal.com">
<input type="hidden" name="item_name" value="Credit Purchase">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="button_subtype" value="services"><input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="Pay now"><img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"></form> 

I´m running into an issue that I detected today. I have the following paypal button config :

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" i d="paypalFormId">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="mybusinessID">
    <input type="hidden" name="lc" value="DE">
    <input type="hidden" name="button_subtype" value="services">
    <input type="hidden" name="no_note" value="1">
    <input type="hidden" name="no_shipping" value="2">
    <input type="hidden" name="item_name" value="MyProductName">
    <input type="hidden" name="amount" value="1.00">
    <input type="hidden" name="custom" value="somecustom infos needed in the redirection">
    <input type="hidden" name="rm" value="2">
    <input type="hidden" name="return" value="https://myreturnurl.com">
    <input type="hidden" name="cancel_return" value="https://mycancelurl.com">
    <input type="hidden" name="currency_code" value="EUR">
    <input type="hidden" name="notify_url" value="myIPNUrl">
    <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
    <div class="row">
       <button type="submit" class="btn btn-submit-next pull-right">Bestellung abschließen</button>
    </div>

I didn´t change anything that could impact this code in the last days, nevertheless, redirection POST parameters are missing and redirection is a GET now and not a POST method anymore, even with the rm=2 !

Any idea, what´s going on ?

Best regards,

Antoine

Edited :

I was able to isolate the issue on JSFiddle : if I remove the item_name input then it works. I have no clue why but maybe it helps you guy telling me what I do wrong !

解决方案

We had the same problem. You need to enable "PDT", then the custom field will be returned in the "cm" variable of the return url post.

"Auto Return" also needs to be enabled to use "PDT", but you can still set the return URL in the button form post instead of in the "Auto Return" config if you need it to be dynamic.

https://developer.paypal.com/docs/classic/products/payment-data-transfer/

Try out this sandbox pay button and see what the response looks like when it is recorded on our return URL.

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick"><input type="hidden" name="amount" value="0.67">
<input type="hidden" name="cancel_return" value="http://test.smsportal.co.za/onlinePaymentv2/Testing3rdPartyResponse.aspx"> 
<input type="hidden" name="custom" value="this is the custom variable. it is named 'cm' in the returned Url."> 
<input type="hidden" name="return" value="http://test.smsportal.co.za/onlinePaymentv2/Testing3rdPartyResponse.aspx"> 
<input type="hidden" name="rm" value="2"> 
<input type="hidden" name="cbt" value="Return to Merchant"> <input type="hidden" name="business" value="paypalmerchant@smsportal.com">
<input type="hidden" name="item_name" value="Credit Purchase">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="button_subtype" value="services"><input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="Pay now"><img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"></form>

这篇关于Paypal BuyNow-使用returnUrl参数的GET而不是POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆