970_90

Tuesday, 29 March 2016

Paypal Buynow button with Dynamic Fields

paypal buynow button with dynamic fields


DEMO - (Please Don't do Payment).





Sandbox Custom Button
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_xclick" />
    <input name="business" type="hidden" value="business_a@no-spam.ws" />
    <input name="no_shipping" type="hidden" value="1" />    
    <input name="item_name" type="hidden" value="Product Name" />
    <input name="item_number" type="hidden" value="123456" />
    <input name="amount" type="hidden" value="10.25" />
    <input name="currency_code" type="hidden" value="USD" />
    <input alt="PayPal - The safer, easier way to pay online!" border="0" name="submit" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" type="image" />
    <input name="return" type="hidden" value="http://example.com/ohio-university/success/tour_type/private" />
    <input name="cancel_return" type="hidden" value="http://example.com/ohio-university/cancelled/order_id/00010" />        
    <input name="notify_url" type="hidden" value="http://example.com/ohio-university/ipn/order_id/00010" />        
    <input name="button_subtype" type="hidden" value="services" />
</form>




Paypal Custom Button
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_xclick" />
    <input name="business" type="hidden" value="business_a@no-spam.ws" />
    <input name="no_shipping" type="hidden" value="1" />
    <input name="item_name" type="hidden" value="Product Name" />
    <input name="item_number" type="hidden" value="123456" />
    <input name="amount" type="hidden" value="10.25" />
    <input name="currency_code" type="hidden" value="USD" />
    <input alt="PayPal - The safer, easier way to pay online!" border="0" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" type="image" />
    <input name="return" type="hidden" value="http://example.com/ohio-university/success/tour_type/private" />
    <input name="cancel_return" type="hidden" value="http://example.com/ohio-university/cancelled/order_id/00010" />        
    <input name="notify_url" type="hidden" value="http://example.com/ohio-university/ipn/order_id/00010" />        
    <input name="button_subtype" type="hidden" value="services" />
</form>

Understand the Hidden variables
  1. cmd:value is _xclick, means this is Buy Now page.
  2. business: paypal email address where you will received the payment.
  3. no_shipping: Show the shipping details in paypal checckout page, 0-Hide, 1-Show.
  4. item_name: Product Name display in paypal cart page.
  5. item_number: this is order number and should be always unique.
  6. amount: Amount of order.
  7. currency_code: Currency code of order amount.
  8. return: After order complete, user will return to this URL.
  9. cancel_return: If user cancel the payment in paypal checkout page, he will return to this URL.
  10. notify_url: This is notify URL for developer, where developer update the details after payment success/failed/onHold etc.


No comments:

Post a Comment