开发者

Paypal Integration with PHP

I am using this code to create my subscription for PayPal. But it is not recognizing any of my input fields. Would you be able to shed some light on why not?

开发者_Go百科
<form method="POST" name="gateway_form" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" name="rm" value="2"/>
<input type="hidden" name="cmd" value="_xclick"/>
<input type="hidden" name="business" value="EMAIL"/>
<input type="hidden" name="currency_code" value="CAD"/>
<input type="hidden" name="return" value="http://www.URL.com/payment/paypal_success.php"/>
<input type="hidden" name="cancel_return" value="http://www.URL.com/payment/paypal_failure.php"/>
<input type="hidden" name="notify_url" value="http://www.URL.com/payment/paypal_ipn.php"/>
<input type="hidden" name="item_name" value="Monthly Subscription"/>
<input type="hidden" name="discount_amount" value="0.00"/>
<input type="hidden" name="a3" value="49.00"/>

<input type="hidden" name="t3" value="M"/>
<input type="hidden" name="p3" value="30"/>
<input type="hidden" name="src" value="1"/>
<input type="hidden" name="sra" value="1"/>
<input type="hidden" name="srt" value="1"/>

<input type="submit" value="Click Here"></p>
</form>


You need to tell PayPal who is submitting the request by submitting the required URL parameters user, pwd, version, and (recommended but optional) signature, along with the other parameters you're sending in the POST request. See API Overview.


Take a look at this link:

Subscriptions and Recurring Payments Variables

https://www.paypal.com/cgi-bin/webscr?cmd=p/acc/ipn-subscriptions-outside

Also, I suggest you use a hosted button. It makes the whole process very easy.


Well both you guys were right, but the issue that came about was because on my 3rd line there

<input type="hidden" name="cmd" value="_xclick"/>

needs to become

<input type="hidden" name="cmd" value="_xclick-subscriptions"/>

Thanks for your help!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜