Billing API Framework [Paypal and more...]
Intro
The Billing API is a secure framework from which premium subscription panels can be built upon. It's secure, advanced and unique - currently no live Hotel uses anything similar (that means Blah Hotel, Habbo BZ, Habbok, Fatal Hotel, Zap Hotel, HabRockz, etc.).
There is no Paypal-end editting, none of that IPN setting up crap. My methods are much cleaner and much more customizable (especially if you are using my panel).
If you use the code as-is, it will work although it is not the "friendliest" setup, meaning there is no back-end panel, everything needs to be manually edited in the code, etc. If you would like the panel its self, which includes other payment api's such as DaoPay, SMS Pay, etc. contact me through MSN.
Billing API
(note: this tutorial is made for Uber, although this could easily work in Pheonix if you change up the steps a little bit).
1. Create a folder called "payment_api" in the includes/ directory of your website, create a file called "paypal.php" inside the includes/payment_api/ directory.
Copy and paste the following code in "paypal.php":
2. Replace the "// Success." with appropriate PHP code upon success of a payment (to update the account, log payment, etc.).
Here is a demo code of what could be their:
3. Replace the "// Fail." with the appropriate PHP code upon failure of a payment (log it, etc.).
No demo code provided.
4. Create a new page where you would like the user to go to when they want to purchase VIP ("/payment/", etc.).
Copy and paste the following HTML into that file. Note, fill in the colored spots appropriately.
Documentation
I will provide this when I get back.
Screen Shots
The following are screen shots of my panel which has all of this coded it. It's an external panel with quite a bit more functionality than what I release above. You can talk to me on MSN if you are interested in using my panel and getting a feature list.
Contact
I will not offer setup assistance (unless you are using my proper panel), although I will answer appropriate thoughtful questions. My MSN is [email protected].
Note, I checked all the popular Hotels to see if they had anything similar to this. They do not. I will be able to tell who is using my methods, if you do not add visual copyrights you will be in trouble.
Billing API Framework
Intro
The Billing API is a secure framework from which premium subscription panels can be built upon. It's secure, advanced and unique - currently no live Hotel uses anything similar (that means Blah Hotel, Habbo BZ, Habbok, Fatal Hotel, Zap Hotel, HabRockz, etc.).
There is no Paypal-end editting, none of that IPN setting up crap. My methods are much cleaner and much more customizable (especially if you are using my panel).
If you use the code as-is, it will work although it is not the "friendliest" setup, meaning there is no back-end panel, everything needs to be manually edited in the code, etc. If you would like the panel its self, which includes other payment api's such as DaoPay, SMS Pay, etc. contact me through MSN.
Billing API
(note: this tutorial is made for Uber, although this could easily work in Pheonix if you change up the steps a little bit).
1. Create a folder called "payment_api" in the includes/ directory of your website, create a file called "paypal.php" inside the includes/payment_api/ directory.
Copy and paste the following code in "paypal.php":
Code:
<?php
// Read the post from PayPal system and add "cmd".
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value):
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
endforeach;
// Post back to PayPal system to validate.
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
// Opens socket.
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
//$fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30);
// List of relevant/important posted variables.
$item_number = $_POST['item_number'];
$quantity = $_POST['quantity'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$payment_status = $_POST['payment_status'];
$payment_type = $_POST['payment_type'];
$payment_date = $_POST['payment_date'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$payer_business_name = $_POST['payer_business_name'];
$payer_email = $_POST['payer_email'];
$address_street = $_POST['address_street'];
$address_zip = $_POST['address_zip'];
$address_city = $_POST['address_city'];
$address_state = $_POST['address_state'];
$address_country = $_POST['address_country'];
$address_country_code = $_POST['address_country_code'];
$residence_country = $_POST['residence_country'];
$custom = $_POST['custom'];
if (!$fp):
// HTTP error.
else:
fputs($fp, $header . $req);
while (!feof($fp)):
$res = fgets($fp, 1024);
if (strcmp($res, "VERIFIED") == 0):
[COLOR="SeaGreen"]// Success.[/COLOR]
elseif (strcmp($res, "INVALID") == 0):
[COLOR="Red"]// Fail.[/COLOR]
endif;
endwhile;
fclose($fp);
endif;
?>
2. Replace the "// Success." with appropriate PHP code upon success of a payment (to update the account, log payment, etc.).
Here is a demo code of what could be their:
Code:
$credits_increase = 500;
$activity_points_increase = 1000;
$connect = mysql_connect('localhost:3306', 'root', 'password');
if ($connect):
$select = mysql_select_db('habbo_database');
else:
exit;
endif;
while ($row = mysql_fetch_object(mysql_query("SELECT DISTINCT * FROM users AS u WHERE u.username = '{$custom}' LIMIT 0,1;"))):
if ($row['rank'] == 1):
$query_update = mysql_query("UPDATE users SET rank = '2' AND credits = credits + {$credits_increase} AND activiy_points = activity_points + {$activity_points_increase} WHERE username = '{$custom}';");
else:
$query_update = mysql_query("UPDATE users SET AND credits = credits + {$credits_increase} AND activiy_points = activity_points + {$activity_points_increase} WHERE username = '{$custom}';");
endif;
// Add a badge query here to give them VIP badge.
endwhile;
3. Replace the "// Fail." with the appropriate PHP code upon failure of a payment (log it, etc.).
No demo code provided.
4. Create a new page where you would like the user to go to when they want to purchase VIP ("/payment/", etc.).
Copy and paste the following HTML into that file. Note, fill in the colored spots appropriately.
Code:
<!-- (s) Subscription #1 -->
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<fieldset>
<legend>Premium Bronze Subscription - <strong>$4.00 (USD)</strong></legend>
Features include;
<br />
<br />
- VIP rank (rank 2).<br />
- VIP badge.<br />
- VIP catalog access.<br />
- Username on VIP list.<br />
<br />
The "Premium Bronze Subscription" lasts for 1 year (365 days).
<div class="float_right">
<input class="submit" type="submit" name="order_1" value="Order" />
</div>
</fieldset>
<!-- (s) Paypal Fields -->
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="[COLOR="SeaGreen"][email protected] (paypal e-mail)[/COLOR]" />
<input type="hidden" name="item_name" value="[COLOR="SeaGreen"]Subscription Name (VIP, etc.)[/COLOR]" />
<input type="hidden" name="item_number" value="[COLOR="SeaGreen"]Item Number (optional)[/COLOR]" />
<input type="hidden" name="amount" value="[COLOR="SeaGreen"]price (4.00, 10.00, etc.)[/COLOR]" />
<input type="hidden" name="currency_code" value="[COLOR="SeaGreen"]Currency Code (USD)[/COLOR]" />
<input type="hidden" name="return" value="[COLOR="SeaGreen"]http://yourhotel.com/payment_success/[/COLOR]" />
<input type="hidden" name="cancel_return" value="[COLOR="SeaGreen"]http://yourhotel.com/payment_fail/[/COLOR]" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="notify_url" value="[COLOR="SeaGreen"]http://yourhotel.com/includes/payment_api/paypal.php (paypal.php URL)[/COLOR]" />
<input type="hidden" name="custom" value="[COLOR="SeaGreen"]<?php echo $username; ?> (something that echos the username)[/COLOR]" />
<input type="hidden" name="no_note" value="1" />
<!-- (e) Paypal Fields -->
</form>
<!-- (e) Subscription #1 -->
Documentation
I will provide this when I get back.
Screen Shots
The following are screen shots of my panel which has all of this coded it. It's an external panel with quite a bit more functionality than what I release above. You can talk to me on MSN if you are interested in using my panel and getting a feature list.
Contact
I will not offer setup assistance (unless you are using my proper panel), although I will answer appropriate thoughtful questions. My MSN is [email protected].
Note, I checked all the popular Hotels to see if they had anything similar to this. They do not. I will be able to tell who is using my methods, if you do not add visual copyrights you will be in trouble.