PHP Classes

File: examples/giftcertificate.php

Recommend this page to a friend!
  Classes of azizny   Paypal Class   examples/giftcertificate.php   Download  
File: examples/giftcertificate.php
Role: Example script
Content type: text/plain
Description: Gift Certificates
Class: Paypal Class
Create buttons and process Paypal payments
Author: By
Last change:
Date: 16 years ago
Size: 2,355 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 gift certificate
*/


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

/***************************** GIFT CERTIFICATE EXAMPLE *****************************/
/* Start Class */
$doGiftCert = new Paypal;

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


$doGiftCert->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
*/
$doGiftCert->addVar('business','itnnetwork@gmail.com'); /* Payment Email */
$doGiftCert->addVar('cmd','_oe-gift-certificate');
$doGiftCert->addVar('currency_code','USD');
$doGiftCert->addVar('amount','99.25');
$doGiftCert->addVar('min_denom','5'); /* Minimum gift price */
$doGiftCert->addVar('max_denom','100'); /* Maximum gift price */
$doGiftCert->addVar('item_name','Script Support');
$doGiftCert->addVar('item_number','PHPCLASS8');

$doGiftCert->addVar('shopping_url','http://awesomephp.com/store.php'); /* URL to Store - Mandatory */

$doGiftCert->addVar('rm','2'); /* Return method must be POST (2) for this class */
/* Paypal IPN URL - MUST BE URL ENCODED */
$doGiftCert->addVar('notify_url','http://awesomephp.com/Demos/Classes/PaypalClass/examples/store.php');
/*
Thank you Page (if any) - not included in this package*/
/*
$doDonate->addVar('return','thanks.html');
*/

/*
Now add a button
*/
$doGiftCert->addButton(4); /* Default gift certificate button */
/* or use custom buttons */
/*
$doGiftCert->addButton(6,'http://icons.iconarchive.com/icons/enhancedlabs/the-real-christmas-05/Gift-Box-Gold-icon.jpg');
*/
/* Show final form */
$doGiftCert->showForm();

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