Software, your way.
How To Get Good Custom Software
(Download)
(PDF)
burger menu icon
WillMaster

WillMaster > LibraryManaging Website Forms

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

PayPal Send-Money Form

We recently added a "support this website" form below Willmaster blog and library articles. I'll show you how to make something similar.

PayPal no longer offers "Donate" payment functionality. So we made our own form where people can contribute funds to help the site.

You'll see a live Support This Website form below this article. The form can be tested without completing the last step to finalize the payment. Finalize the payment only if you wish to contribute to the operations of Willmaster.com.

This article shows you how to make a PayPal payment form for your own websites.

When you see the code, you'll see the form is simple to implement. It can be used for pretty much any simple PayPal payments.

To implement the payment form, you'll need two things.

  1. The PayPal payment form.

  2. A thank-you page (for the payer to land on after they've made the payment and are returned from PayPal).

You'll need a thank-you page URL before you can make the PayPal payment form. So let's get that made, first.

A Thank-You Page

Here's a bare-bones thank-you page you can adapt. Both the amount paid and the transaction ID (that PayPal embeds into the return URL) are inserted into the thank-you page.

<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Thank You</title>
</head>
<body>
<h1>Thank You</h1>
<p>
Your transaction has been completed and PayPal will email a receipt to you. 
</p>
<p>
You may log into your account at <a href="https://www.paypal.com"><nobr>https://www.paypal.com</nobr></a> to view details of this transaction.
</p>
<p>
Transaction amount: <?php echo(@$_GET['amt']); ?>
<br>Transaction ID: <?php echo(@$_GET['tx']); ?>
</p>
</body>
</html>

Upload the page to your server and name it thankyou.php or any other file name with a .php extension.

You'll need the thank-you page's URL when you make the form.

The PayPal Payment Form

To make the form, you'll need two additional items.

  1. A PayPal image button for the form.

    You may copy the PayPal image from our live Support This Website form found below this article, or create your own. (Alternatively, a regular submit button could be used instead of an image button.)

  2. Your PayPal Business ID.

    You could use your PayPal email address as the Business ID — either will work. However, because of the proliferation of spam bots, it isn't recommended to make your PayPal email address available in a public web page form.

    PayPal recently re-designed their merchant interface. You'll probably find your Merchant ID at Profile and SettingsMerchant account ID.

When you have the PayPal image URL, your Merchant ID, and the URL of the thank-you page, you can go ahead and install the payment form. Here is the source code (comments follow).

<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_xclick"><!-- PayPal required field and value -->
<input type="hidden" name="business"  value="SFJJF7CEMT8HG">              <!-- Business ID -->
<input type="hidden" name="item_name" value="Contribution">               <!-- Item name -->
<input type="hidden" name="return"    value="http://example.com/page.php"><!-- After-payment URL -->
Amount:
<br><input 
    type="text" 
    name="amount" 
    style="width:109px; border:1px solid #ccc; height:35px; border-radius:.25em;">
<br><input 
    type="image" 
    src="https://example.com/image.png" 
    style="border:1px solid #ccc; padding:.25em; border-radius:.25em; margin-top:9px;">
</form>

There are four items to customize in the PayPal payment form source code.

  1. Replace SFJJF7CEMT8HG with your Merchant ID.

  2. Replace Contribution with a description of what the payment will be for.

  3. Replace http://example.com/page.php with the URL of the thank-you page for the payer to land on after they've made the payment and are returned from PayPal.

  4. Replace https://example.com/image.png with the URL of the image to use for the PayPal image button.

Paste the form into a test web page and verify it works as it should.

Change the design as needed.

You'll notice that typing in a payment amount isn't required. If the form user doesn't type in an amount, PayPal will ask them for it.

As you see, it's a simple form, easy to implement.

(This article first appeared with an issue of the Possibilities newsletter.)

Will Bontrager

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2024 Will Bontrager Software LLC