如何在PayPal结算后返回POST?

时间:2015-05-27 07:13:37

标签: ruby-on-rails paypal

我创建了下一个表单:

<form name="_xclick" action="https://www.sandbox.paypal.com/webscr" method="post">
  <input type="hidden" name="cmd" value="_xclick">
  <input type="hidden" name="business" value="team@team.com">
  <input type="hidden" name="currency_code" value="USD">
  <input type="hidden" name="item_name" value="Subscription">
  <input type="hidden" name="return" value="http://www.my_website.com/<%= params[:locale] %>/success">
  <input type="hidden" name="amount" value="1">
  <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_paynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>

但它通过GET请求重定向到我的网站。如何在付款后通过POST请求重定向到我的网站?

当我在PayPal按钮工厂中创建我的按钮时:

<form action="https://www.sandbox.paypal.com/webscr" method="post" target="_top">
  <input type="hidden" name="cmd" value="_s-xclick">
  <input type="hidden" name="hosted_button_id" value="SOME_VALUE">
  <input type="image" src="https://www.paypalobjects.com/en_US/IL/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
  <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

当我点击PayPal按钮时,我点击了PayPal按钮时设置了成功并取消了重定向,但显示以下错误:

PayPal cannot process this transaction because of a problem with the seller's website. Please contact the seller directly to resolve this problem.

那么,如何更改我的第一个代码,它将在结算后执行POST重定向?

1 个答案:

答案 0 :(得分:0)

请查看“https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/

解决方案的

和“rm”变量。并为paypal付款提交设置隐藏字段值。