Making a PayPal Form Tutorial
How it Works
PayPal makes doing this very easy by providing those “Buy-It-Now” buttons you’ve probably seen around the place. Basically when you see one of those buttons, it is really the submit button on an HTML form with all the form fields set to hidden. This is fine for when you have a set price and set item, but in our situation we want the client to be able to fill out what it is they are paying for (e.g. an invoice number) and also to set how much they are paying.
This is easily done by changing the <input> fields from hidden to text and stripping away the defaults so that the user can fill them in. So let’s get started.
Step 1 – Make a Payment Confirmation Page
First of all you should make a page to send the user to after payment has been processed. For the example form that I am making – one for Tikier's Blog – I created this page http://blog.tikier.com/demos/payment-complete/index.html. On this page you should be placing a simple confirmation message so that your client doesn’t feel like they just sent money off into the ether. Next upload the confirmation page so it’s accessible over the web and you have a URL for it.
Step 2 – Create the Form
Next we create the form. When I first made this form I used the Buy-It-Now button form generator on PayPal and then modified accordingly, but you can just use the code below and make the changes I’ve described further on:
The parts that need modification are as follows:
Item Number
The item number field is this one:
The value you place in this field appears when the user goes to PayPal and clicks the down arrow for more details on their purchase (you can see it by entering some information in the test form below). I’ve used the value “01 – General Payment to Tikier Hosting” and theoretically if I had some other forms for say donation I might write “02 – Donation” and so on.
Business
The business field is this one:
This is the most important field to modify as it is the one that determines where your customer is paying to. You need to substitute in your PayPal email address. So for Tikier Hosting, our PayPal address is paypal [@] mail.com, but obviously you’ll want to change that.
Currency Code
The currency code value in my example form is set to USD, you could change this to your own currency (Cyan and I used to use AUD for Australian Dollars). If you want a list of the different currencies available through PayPal you should log in to your account, click on Merchant Tools then click on Buy Now Buttons and in the form there is a drop down box which lists them.
Return URL
The return URL (or payment confirmation page) is set by this field:
Simply swap in the URL you created in Step 1.
Item Name
The item_name field is the one where your user describes what they are paying for. When billing clients I set up my form to have “Invoice Number” and in the invoices we sent out under “How to Pay” it explained that you had to get the invoice number from the top right of the bill and type it into the form. In my example form below, I’ve written simply Item Details, so theoretically you could write anything in there – e.g. “Payment for Providing Amazing Freelancing Website, Thanks” and that will appear in PayPal when you go to purchase.
Note that if this were a Buy-Now button form, then the item_name would be a Hidden field with a default value, but we’ve changed it to a text field so the user can decide what they are paying for.
Amount
The amount field is pretty self explanatory. The only thing to note is that if the user types anything other than a number in here PayPal will return an error, so you might want to use some Javascript to do validation on this field and ensure it’s a number – though that’s not necessary. The main problem is your users might be tempted to write in a dollar sign – e.g. “$450″ which results in an error. Another solution would be to write a $ sign before the form field.
Step 3 – Test!
OK and that’s it really! Here is the example form that i just made…
Update: I had to put in a fake email address into the form below as a few people accidentally tested it with rather large amounts of money
Related posts:
- Form Validation
- Ajax form validation
- CSS Tutorial – Generated Content
- Making an interactive country map
Print This Post
Enjoy this article?
Live Help
Coupons
VPS Hosting starting @ $15.99 / month
Social Badge
Subscribe
Links
Recent Comments
- Katherine Campbell on 301 Redirect – The SEO way to rename or move files or folders
- Rusty on Center Multiple DIVs with CSS
- Zachary Graham on Release Notification: 11.25.0 DNSONLY
- Trinity James on 301 Redirect – The SEO way to rename or move files or folders
- Isabelle Gonzales on 301 Redirect – The SEO way to rename or move files or folders
Recent Posts
- Center Multiple DIVs with CSS
- Better Page Corner Ads with CSS3 Transforms
- A Do-It-Yourself Search Engine Optimization Technique That Will Work Miracles For You?
- 10 Ways To Increase Your Blog’s Pageviews
- 3 Most Important Services For A Profitable Internet Home Business
Categories
- Blogging (19)
- News (55)
- Random Articles (12)
- SEO Tips (34)
- Site Promotion (19)
- Traffic Generation (18)
- Tutorials (66)
- css (22)
- flash (8)
- html (8)
- illustrator (7)
- JavaScript (6)
- photoshop (7)
- php (8)
- Website building (20)
