Monthly Archives: November 2012

PHP Paypal Recurring PayPro Flow

I spend several day to figure our Paypal Recurring PayPro Flow Payment API.
But finally managed to create something cool with a class. I would like to share with you guys.

Why Paypal Recurring PayPro Flo ?
Companies want to charge there customers on monthly basics for different services that’s why its called Recurring. With PayPro Flow Payment API it become smooth and as a advantage user/customer does not leave site while making payment. Paypal will charge you $30 per month to create this account with PayPro Flow Payment system. This is where you can see everything related to your account.
In order to activate Recurring you need to make phone call to Paypal account manger and request them to enable Recurring then only it will work.

Code and examples –
This class “PayFlowTransaction.class.php” have everything you need.
Apart from that there is one more file, which you will be using to pass your form variables and it will show you result. So called instance!

What you can do with this class and code –
1. Create Recurring Billing Profile
2. Modify – Recurring Billing Amount and CC detials or anything
3. Reactivate – Reactivate Cancelled profile.
4. Cancel – You can cancel profile anytime
5. Inquiry – Details of each payment for a profile and Status of a customer’s profile
6. Payment – Retry a previously failed payment
You have to just pass correct variable and look litte bit in this documentation
In order to see this code in action you need to have your own account.

$txn->PARTNER = ‘PayPal’; // this is default
$txn->USER = ‘your_username’;
$txn->PWD= ‘You_should_ask_to_admin’;
$txn->VENDOR = ‘yourvendername_checkwith_your_admin’; //$txn->USER; //or your vendor name



Code above is very easy to understand.

//ini_set(‘display_errors’, 1);
//ini_set(‘log_errors’, 1);
//ini_set(‘error_log’, dirname(__FILE__) . ‘/error_log.txt’);
// error_reporting(E_ALL);

this is to show error if you have any.
and rest of them are variables.

Hope it will cut down your development time.


How to merge two mysql query results into one array?

You can use UNION operator to merge the result-set of two or more SELECT statements into one array.
The default behavior for UNION is that duplicate rows are removed from the result. UNION ALL does not remove duplicate.

There are few things need to be kept in mind.

A. SELECT statement within the UNION must have the same number of columns.
B. The field should have similar data types.
C. Fields in each SELECT statement must be in the same order if not make them.
D. If column have diffrent name make column another name by using an alias with “AS” kewords as given in the example

SELECT column1 AS alias_name FROM table

Here is the full example of UNION.


How to select all check boxes with one click ?

Selecting multiple items from a list to process them or delete them is just one like of jquery program.

Here is another version which does not use fieldset


How to pass select box drop down value to multiple text boxes?

This code allow you to select dropdown value to multiple text boxes which have same name or class.
Very useful if you are creating price table and want to pass data to next page.


Javascript terms & condition checkbox validation

Most of the form have terms & condition and they required user to select checkbox if checkbox is not selected foem will not post.

This is very simple example.