PayPal Form Without Merchant ID
What if you want to use a form so people can order things from you or simply pay you money via PayPal? And what if you do not have a PayPal Merchant ID or don't know where to find it at the PayPal merchant's dashboard?
You can submit your form to PayPal using your email address instead of your Merchant ID.
The thing about that is the email address is vulnerable to spambot address harvesting, even if the address is in a type="hidden"
form field.
Instead of putting the email address into the form, the form can be submitted to a relay script. The relay script inserts your PayPal email address into the proper form field and sends the payment authorization order to PayPal.
Here is the relay script. Customization note follows.
<?php
/*
Form to PayPal with Email Address
Version 1.0
December 24, 2024
Will Bontrager Software LLC
https://www.willmaster.com/
*/
/* Customization. Specify the PayPal email address. */
$PayPalEmail = "name@example.com";
/* End of customization. */
if( empty($_POST) or (count($_POST)<2) ) { echo 'Inappropriate Access'; exit; }
mb_regex_encoding('UTF-8');
mb_internal_encoding('UTF-8');
date_default_timezone_set('UTC');
$items = array();
$items[] = 'business='.rawurlencode($PayPalEmail);
foreach( $_POST as $k => $v )
{
$LogLine[] = str_replace('"','""',"$kk=$vv");
$kk = rawurlencode($kk);
$vv = rawurlencode($vv);
$items[] = "$kk=$vv";
}
$PayPalURL = 'https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&'.implode('&',$items);
if( headers_sent() ) { echo "<script>location.href='$PayPalURL'</script>"; }
else { header("Location: $PayPalURL"); }
exit;
?>
There is one place to customize, your PayPal email address. Replace name@example.com
with your PayPal email address.
Installation
First, the relay script needs to be uploaded.
Name the customized relay script
paypalsupport.php
or other*.php
file name you prefer.-
Upload
paypalsupport.php
to your server and make a note of its URL.
Then, your PayPal form needs to be modified.
-
Change the
form
tag'saction
attribute from the PayPal URL to the URL of thepaypalsupport.php
script. -
Remove the hidden field that currently contains your email address or PayPal Merchant ID.
That's it. You should be good to go. But test it, of course.
When it passes, your PayPal form is submitted to the paypalsupport.php
script. The paypalsupport.php
script adds your PayPal Merchant ID or your PayPal email address. Then all that information (the form information and your PayPal identification) is sent to PayPal.
The buyer is taken to PayPal to arrange payment, just like the buyer would expect.
If you do not know how to build a form for people to use to pay you, here are two articles. Each describes how to make a PayPal form. The first, PayPal Send-Money Form, describes how to make a simple send-money form. The second, Checkbox Shopping Cart, describes how to make a more elaborate form that can function as a shopping cart.
(This article first appeared with an issue of the Possibilities newsletter.)
Will Bontrager