alexel alexel - 7 months ago 28
Javascript Question

PayPal Subscription API

I want to setup a subscription based payment system via PayPal. I currently am using PayPal's api for a few of my items and an IPN listener. The code is as provided:

<form name="_xclick" action="https://www.paypal.com/us/cgi-bin/webscr" class="form-horizontal" method="post" id="paypalformhidden">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="sales@example.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" id="ppname" name="item_name" value='Large Brwon Teddy Bear' />
<input type="hidden" name="item_name1" value='Ted' />
<input type="hidden" name="notify_url" value="example.com/listener.php">
<input type="hidden" name="return" value="example.com"/>
<input type="hidden" id="ppamount" name="amount" value='39.00'>


I thought the subscription is as easy as this, but it seems unfriendly. I'd love some input!

Answer

The _xclick command is for "Buy Now" buttons. There's a different command value for Subscription buttons. You can read more about setting up a Subscribe button here on PayPal's developer site: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/subscribe_buttons/#id08ADF1008HS

Comments