Web Hosting Talk







View Full Version : making your own payment processor.


axe9
01-03-2005, 06:28 PM
I'm amazed at myself.
Rather then spending a ridiculous ammount of money for a payment processor like ModernBill, I decided to create my own! And I did O_O

Using PayPal, HTML, a few forms (php procs), and a lot and hard and tedious work, you can create a quite effective payment system for you and your customers!

:D

Alright, one thing I must say, is doing this is insanely tedious and time consuming, since I've provided most of the code and stuff, it wont take you as long, but depending on how many products you have, it takes hours. I have 30 hosting packages, and each has yearly, monthly, and quarterly payment options. For each, I had to do one sepparate paypal subscription link XD I've spent a total of 9 hours working on this + 3-4 hours on the programming part.

Some code snippits might not work, and if you see something wrong, point it out, and I'll change it.

Well, thanks for reading all this, lets get into the guide :D

The first thing you need to know is how to get to this portion.
From my signup form, when submitted, you go to the payment section of my website. You select what billing cycle you want, the billing method (check or paypal in this case), and the hosting plan you're signing up for.


<form action="billing.php" method="post" name="select_method" id="select_method">
<div align="left">
<p class="style1"><span class="style3">Select Billing Info </span></p>
<p>
<select name="cycle" id="select" onChange="MM_jumpMenu('parent',this,0)">
<option selected>Billing Cycle</option>
<option value="monthly">Monthly</option>
<option value="quarterly">quarterly</option>
<option value="yearly">yearly</option>
</select>
<br>
<select name="method" id="method">
<option selected>Method</option>
<option value="paypal">PayPal</option>
<option value="check">Check</option>
</select>
<br>
<select name="plan" id="plan">
<option selected>Plan</option>
<option>Small Business</option>
<option value="small1">Level 1</option>
<option value="small2">Level 2</option>
<option value="small3">Level 3</option>
<option>Medium Business</option>
<option value="med1">Level 1</option>
<option value="med2">Level 2</option>
<option value="med3">Level 3</option>
<option>Large Business</option>
<option value="med1">Level 1</option>
<option value="med2">Level 2</option>
<option value="med3">Level 3</option>
<option>Plus Hosting</option>
<option value="plus1">Plus 1</option>
<option value="plus2">Plus 2</option>
<option value="plus3">Plus 3</option>
<option>Clan Sites</option>
<option value="clan1">Small</option>
<option value="clan2">Medium</option>
<option value="clan3">Large</option>
<option value="clan4">Huge</option>
<option value="clan5">High Bandwidth</option>
<option>Hobby Sites</option>
<option value="hobby1">Small</option>
<option value="hobby2">Medium</option>
<option value="hobby3">Large</option>
<option value="hobby 4">Huge</option>
<option value="hobby5">High Bandwidth</option>
<option value="hobby6">Image Hosting</option>
</select>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
<br>
</p>
</div>
</form>

axe9
01-03-2005, 07:08 PM
er... Didn't know you couldn't edit your posts after 15 mins... Sorry for the double.


#########################
I'm amazed at myself.
Rather then spending a ridiculous amount of money for a payment processor like ModernBill, I decided to create my own! And I did O_O

Using PayPal, HTML, a few forms (php procs), and a lot and hard and tedious work, you can create a quite effective payment system for you and your customers!

:D

Alright, one thing I must say, is doing this is insanely tedious and time consuming, since I've provided most of the code and stuff, it wont take you as long, but depending on how many products you have, it takes hours. I have 30 hosting packages, and each has yearly, monthly, and quarterly payment options. For each, I had to do one separate paypal subscription link XD I've spent a total of 9 hours working on this + 3-4 hours on the programming part.

Some code snippets might not work, and if you see something wrong, point it out, and I'll change it.

Well, thanks for reading all this, lets get into the guide :D

The first thing you need to know is how to get to this portion.
From my signup form, when submitted, you go to the payment section of my website. You select what billing cycle you want, the billing method (check or paypal in this case), and the hosting plan you're signing up for.


<form action="billing.php" method="post" name="select_method" id="select_method">
<div align="left">
<p class="style1"><span class="style3">Select Billing Info </span></p>
<p>
<select name="cycle" id="cycle">
<option selected>Billing Cycle</option>
<option value="monthly">Monthly</option>
<option value="quarterly">quarterly</option>
<option value="yearly">yearly</option>
</select>
<br>
<select name="method" id="method">
<option selected>Method</option>
<option value="paypal">PayPal</option>
<option value="check">Check</option>
</select>
<br>
<select name="plan" id="plan">
<option selected>Plan</option>
<option>Small Business</option>
<option value="small1">Level 1</option>
<option value="small2">Level 2</option>
<option value="small3">Level 3</option>
<option>Medium Business</option>
<option value="med1">Level 1</option>
<option value="med2">Level 2</option>
<option value="med3">Level 3</option>
<option>Large Business</option>
<option value="med1">Level 1</option>
<option value="med2">Level 2</option>
<option value="med3">Level 3</option>
<option>Plus Hosting</option>
<option value="plus1">Plus 1</option>
<option value="plus2">Plus 2</option>
<option value="plus3">Plus 3</option>
<option>Clan Sites</option>
<option value="clan1">Small</option>
<option value="clan2">Medium</option>
<option value="clan3">Large</option>
<option value="clan4">Huge</option>
<option value="clan5">High Bandwidth</option>
<option>Hobby Sites</option>
<option value="hobby1">Small</option>
<option value="hobby2">Medium</option>
<option value="hobby3">Large</option>
<option value="hobby 4">Huge</option>
<option value="hobby5">High Bandwidth</option>
<option value="hobby6">Image Hosting</option>
</select>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
<br>
</p>
</div>
</form>


When the submit button is clicked, the form calls this php form processor.


<?php

// This code is (c) Axe9.com, 2004-2005; All Rights Reserved.
// Let's Check that all required fields are complete

if(empty($cycle))
{
echo "<h2>Click Back on your Browser and select your billing cycle</h2>\n";
}
elseif(empty($method))
{
echo "<h2>Click Back on your Browser and select payment method</h2>\n";
}
elseif(empty($plan))
{
echo "<h2>Click Back on your Browser and select hosting plan</h2>\n";
} else {
// This part changes the url variable if the check payment option is selected. When the form is submitted with check for payment, it sends the user to a page that gives information on how to send in checks to pay for hosting.
if (check(method))
{
$url="http://axe9.com/billing/check.htm";
} else {
//This sets the url variable to go to the correct page based on the options the user has selected.
$url="http://axe9.com/billing/$method/$cycle/$plan/";
}
header("location: $url");
}
?>


From here, it's basically just making the PayPal buttons.
You need to create a directory "billing" with the correct subdirectories for the options you set to work.
Then create a bunch of index.html pages, put them in the directories for the products, and then put the code for the paypal buttons in each according to the options you want.

I wouldn't suggest anyone using this system for more then 10 products. You can, and it should work fine, but it's just tedious.

That's it unless I think of something else.