Login   Register  
PHP Classes
elePHPant
Icontem

File: examples/donation.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of azizny  >  Paypal Class  >  examples/donation.php  >  Download  
File: examples/donation.php
Role: Example script
Content type: text/plain
Description: Donations
Class: Paypal Class
Create buttons and process Paypal payments
Author: By
Last change:
Date: 2008-10-29 07:03
Size: 2,176 bytes
 

Contents

Class file image Download
<?php

/**************************************************/
/*
Released by AwesomePHP.com, under the GPL License, a
copy of it should be attached to the zip file, or
you can view it on http://AwesomePHP.com/gpl.txt
*/
/**************************************************/

/*
This file will display
a form to make a donation
*/


/* Get Paypal Class */
require_once('../paypal.class.php');

/***************************** DONATION EXAMPLE *****************************/
/* Start Class */
$doDonate = new Paypal;

/*
Do you want to test payments
before you actually make a real
payment? If So use the test mode:


$doDonate->useSandBox(true);


You will also need to create a sandbox account
https://developer.paypal.com/
and then create a test account to which you will
use when making the test payments
*/

/*
Add variables to Form 
PARAMTERS MUST ADHERE TO PAYPAL STANDARDS
View all paramters @ PaypalVariables.html
located in main folder of this class
*/
$doDonate->addVar('business','itnnetwork@gmail.com');    /* Payment Email */
$doDonate->addVar('cmd','_donations');
$doDonate->addVar('amount','99.25');
$doDonate->addVar('item_name','Script Support');
$doDonate->addVar('item_number','PHPCLASS8');
$doDonate->addVar('quantity','1');
$doDonate->addVar('tax','1.99');
$doDonate->addVar('currency_code','USD');
$doDonate->addVar('no_shipping','0');        /* No shipping address needed*/
$doDonate->addVar('rm','2');            /* Return method must be POST (2) for this class */
/* Paypal IPN URL - MUST BE URL ENCODED */
$doDonate->addVar('notify_url','http://awesomephp.com/Demos/Classes/PaypalClass/examples/checkpayment.php');
/*
Thank you Page (if any) - not included in this package*/
/* 
$doDonate->addVar('return','thanks.html');
*/

/*
Now add a button
*/
$doDonate->addButton(3);    /* Default donation button */
/* or use custom buttons */
/*
$doDonate->addButton(6,'http://farm1.static.flickr.com/164/424272697_33b14162ec.jpg?v=0');
*/
/* Show final form */
$doDonate->showForm();

/*
To get the form in URL Form (when supported)
You use:
*/
echo '<a href="'.$doDonate->getLink().'">Click Here</a>';
?>