PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Szilágyi Gábor  >  Paypal Open Cart  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example php script
Class: Paypal Open Cart
Generate buttons to pay for products in Paypal
Author: By
Last change:
Date: 5 years ago
Size: 1,156 bytes


Class file image Download

//Example to use paypal object


//You can set default options with constructor method
$paypalObject = new paypal("_cart","1","utf-8","");

//Or other methods
//For multiple items

//Default way to add items to cart by passing to array (one for names and one for amounts)
$products = array("Test product 1","Test product 2");
$prices = array(100,200);

//Other way is use the addItemToCart method (first param: item name, second param: amount)
$paypalObject->addItemToCart("Test product 3",300);

//Set the submit button ID and displayed text
$paypalObject->submitButtonID = "sendPaypal";
$paypalObject->submitButtonText = "Pay on paypal";

//Generate paypal form (parameter used to set submit button)
$cartForm = $paypalObject->cart(true);