AndrewFerrara
AndrewFerrara

Reputation: 2403

automatically create buy now button paypal?

I want to automatically create a paypal buy now button.

What is the easiest way to do it?

Upvotes: 10

Views: 10015

Answers (4)

David Newcomb
David Newcomb

Reputation: 10943

I know it's been a while but this was the best help:

https://www.paypal.com/cgi-bin/webscr?cmd=_singleitem-intro-outside

Just fill in the form and PayPal will generate the HTML form for you. Under the Buttons navigation on the left you can also generate the code for "Buy Now", "Add to Cart", "Donate", "Buy Gift Certificate" and "Subscribe".

Upvotes: 0

Joby Joseph
Joby Joseph

Reputation: 2277

The HTML Code to add a simple paypal buy now button is this:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <!-- Identify your business so that you can collect the payments. -->
    <input type="hidden" name="business" value="[email protected]">
    <!-- Specify a Buy Now button. -->
    <input type="hidden" name="cmd" value="_xclick">
    <!-- Specify details about the item that buyers will purchase. -->
    <input type="hidden" name="item_name" value="Demo Ebook">
    <input type="hidden" name="amount" value="5">
    <input type="hidden" name="currency_code" value="USD">
    <!-- Display the payment button. -->
    <input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
    <img alt="" border="0" width="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif">
</form>

If you want to change the items dynamically just change the item_name value.

More information with demo and download link can be found here

Upvotes: 1

AndrewFerrara
AndrewFerrara

Reputation: 2403

I also found out that you can pass the info in a url like this:

https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&[email protected]&item_name=Hot Sauce-12+oz.+Bottle&item_number=12345&amount=5%2e95&currency_code=USD

and you could do something like this:

<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&[email protected]&item_name=Hot Sauce-12+oz.+Bottle&item_number=12345&amount=5%2e95&currency_code=USD">
<img src="/buynow.png" />
</a>

Upvotes: 17

anon271334
anon271334

Reputation:

The following page lists the minimum-required information for a Buy Now button. I've included the most simple example:

https://www.paypal.com/cgi-bin/webscr?cmd=_pdn_xclick_techview_outside

<?php
echo '<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="Teddy Bear">
<input type="hidden" name="amount" value="12.99">
<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">
</form>';

Don't forget to escape any " ' " characters (single quotes).

Upvotes: 7

Related Questions