eoin
eoin

Reputation: 113

php basic pay now button for paypal

I'm going to attempt to integrate paypal with my php and html website and there seems to be loads of documentation out there on this topic, but some of it is confusing.

What I basically want to do, is have a shopping cart which i will make myself, display all the items a user wants to purchase and have just a single paynow button for these items that will send this info to paypal, and allow the user to login and return them to my site once it's done.

i dont need a cart or add to cart button etc just a button to pay for the goods which will hopefully display price and all relevant data about each item on the paypal page.

if anyone knows of any tutorials they could point me in the direction of for this type of thing i would be grateful.

Upvotes: 2

Views: 11263

Answers (2)

Manse
Manse

Reputation: 38147

Here is a very simple example of the buy now button:

<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>

You just need to change the business, the amount and the item_name

If you need multiple items add them like this :

<input type="hidden" name="item_name_1" value="Toy">
<input type="hidden" name="amount_1" value="10">

<input type="hidden" name="item_name_2" value="Bike">
<input type="hidden" name="amount_2" value="20">

Straight from the Paypal Docs here

Upvotes: 11

belgther
belgther

Reputation: 2534

This page has a pretty good tutorial.

But you might consider encrypting the fields so they don't get manipulated by someone else.

Upvotes: 1

Related Questions