Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Steven  >  TrialPay Dynamic Products Generator  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Use example
Class: TrialPay Dynamic Products Generator
Create buttons to pay for products using TrialPay
Author: By
Last change:
Date: 2012-04-13 15:54
Size: 1,136 bytes
 

Contents

Class file image Download
<?PHP
# static/ is folder with images
# this dir is also available via de static domain; http://static.domain.com/ 
# you can get the different language version of the TrialPay get it free button from the merchant site of trialpay.com
define('STATICURL''http://static.domain.com');

$_SESSION['lng'] = "en";
include_once(
"trialpay.class.php");


function 
GetTrialPImg(){
    
$img "trialpay_free_en.gif";
    if(isset(
$_SESSION['lng'])){
        
$lng strtolower($_SESSION['lng']);
        if(
file_exists("static/trialpay_free_$lng.gif")){
            
$img "trialpay_free_$lng.gif";    
        }else{
            
$img "trialpay_free_en.gif";    
        }        
    }else{
        
$img "trialpay_free_en.gif";
    }
    return 
$img;
}

function 
MakeTrialPayButton($cUrl,$minAmount,$productname,$proddescr,$price,$currency,$prodid,$custParams = array()){
    
$tp = new TrialPay();
    
$tp->SetEncType("aes");
    
$tp->SetCustomParams($custParams);
    
$tp->CreateFormAction($cUrl);
    
$tp->CreateMessage($minAmount,$productname,$proddescr,$price,$currency,$prodid);
    
$tpimg STATICURL."/".GetTrialPImg();
    
$button $tp->CreateForm($tpimg,145,65,"tpbut");
    echo 
$button;
}

?>