PHP Classes

Simple PHP Paypal Button Generator: Create Paypal payment buttons

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 499 All time: 5,822 This week: 488Up
Version License PHP version Categories
simple-paypal-button 1.02GNU General Publi...5.4HTML, PHP 5, E-Commerce
Description 

Author

This class can create Paypal payment buttons.

It can compose the definition of a shopping cart with all the details like the items, prices, currencies, site URL, return URL, etc..

The class generates HTML for a form with hidden inputs and a a payment button to lead the user to purchased the described items with his Paypal account.

The button image and other presentation details are configurable parameters.

Picture of Robert Ireland
Name: Robert Ireland <contact>
Classes: 1 package by
Country: United Kingdom
Age: 47
All time rank: 3267144 in United Kingdom
Week rank: 298 Up12 in United Kingdom Up

Example

<?php
require('PaypalSimpleClass.php');
//change below to you paypal account name
PaypalSimpleClass::singleton("you@yourdomain.com","");
// turn on error reporting
PaypalSimpleClass::setErrorReporting(true);
// turn on sandbox mode
PaypalSimpleClass::setActionUrl("https://www.sandbox.paypal.com/cgi-bin/webscr");
// set return url
PaypalSimpleClass::setReturnUrl('http://www.yourdomain.com/sample.php');
// set a custom button image
//PaypalSimpleClass::setButtonImage('http://www.yourdomain.com/button.png');
// Set the currency code and symbol
PaypalSimpleClass::setCurrency('USD','$');
// create an item
PaypalSimpleClass::setItem(1, 'Test Item 1', '', 10.00, 1.00, '');
// create a product option
PaypalSimpleClass::opt1Name('Colour');
// assign options and price pairs
PaypalSimpleClass::opt1ArrayValue(array(array('Pink', 20.00),array('Red', 22.00)));
// create a product option
PaypalSimpleClass::opt2Name('Size');
// assign options
PaypalSimpleClass::opt2ArrayValue(array('Small','Medium','Large'));
// output form to screen
echo PaypalSimpleClass::getItem();
?>


  Files folder image Files  
File Role Description
Plain text file PaypalSimpleClass.php Class Class File for simple paypal buttons
Plain text file sample.php Example Sample usage

 Version Control Unique User Downloads Download Rankings  
 0%
Total:499
This week:0
All time:5,822
This week:488Up