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 Rajesh Bhatia  >  Merchantware Payment Gateway  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example File
Class: Merchantware Payment Gateway
Submit a payment to Merchantware gateway
Author: By
Last change: Format of expiry date is changed considering code in class file
Date: 2 years ago
Size: 3,341 bytes
 

Contents

Class file image Download
<?php
/**
* This is example file to use merchantware class
* @version 0.1
* @copyright (C) 2011 Rajesh Bhatia. All rights reserved
* @license http://www.gnu.org/copyleft/lesser.html LGPL License
* @author Rajesh Bhatia <rajesh123bhatia@gmail.com> (Blog : http://www.php24.in)
**/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">
    <title>Merchatware Test</title>

    <meta name="robots" content="noindex, nofollow" />
    <link rel="shortcut icon" href="style/images/lock.ico" />

        <style type="text/css">
            body{ font: 92.5% "Trebuchet MS", sans-serif; margin: 25px;}
            input { width:150px; }
            .inputRadio { width:25px; text-align:left; }
            .inputButton { width:75px; }
        </style>

</head>
<body>
<?php
if(isset($_POST['is_submitted']) && ($_POST['is_submitted'] == "yes"))
{
    
ini_set("display_errors","1");
    require_once 
'class.merchantware.php';
    
$objMerchantware = new merchantare();
    
$params = array();
    
$res $objMerchantware->issue_transaction($_POST);
    
$stringRes "";
    
$nameFile "data".time().".txt";
    
$handle fopen($nameFile"w+");
    foreach(
$res as $key=>$value)
    {
        
$stringRes.= $key."=>".$value."\n";
    }
    
fwrite $handle ,$stringRes);
    
fclose($handle);
    
//echo "Information retrieved successfully.";
}
?>
    <form method="post" action="" name="merchantware">
    <table>
        <tr>
            <th colspan="3"><p>Required fields are denoted with a ' * ' character.</p></th>
        </tr>

        <tr>
            <td>
                <label>Amount</label>
            </td>
            <td>
                <input type="text" id="amount" value="0.1" name="amount"/>
            </td>
            <td><p>*</p></td>
        </tr>
        <tr>
            <td>
                <label>Order Number</label>
            </td>
            <td>
                <input type="text" id="order_number" value="34567" name="order_number"/>
            </td>
            <td><p>*</p></td>
        </tr>
        <tr>
            <td>
                <label>Street Address</label>
            </td>
            <td>
                <input type="text" id="vAddrsline1" value="" name="vAddrsline1" />
            </td>
            <td><p>*</p></td>
        </tr>
        <tr>
            <td>
                <label>ZIP</label>
            </td>
            <td>
                <input type="text" id="vZipCode" value="" name="vZipCode" />
            </td>
            <td><p>*</p></td>
        </tr>
           <tr>
            <td>
                <label>Cardholder (Name on Card)</label>
            </td>
            <td>
                <input type="text" id="vNameOnCard" name="vNameOnCard" value="" />
            </td>
            <td><p>*</p></td>
        </tr>
        <tr>
            <td>
                <label>Card Number</label>
            </td>
            <td>
                <input type="text" id="vCardNumber" name="vCardNumber" value="" />
            </td>
            <td><p>*</p></td>
        </tr>
        <tr>
            <td>
                <label>CCV Code</label>
            </td>
            <td>
                <input type="text" id="vCCVCode" name="vCCVCode" value="" />
            </td>
            <td><p>*</p></td>
        </tr>
        <tr>
            <td>
                <label>Expiry Date</label>
            </td>
            <td>
                <input type="text" id="vExpireDate" name="vExpireDate" value=""/>
            </td>
            <td><p>*(e.g. 12/20 i.e MM/YY)</p></td>
        </tr>
           <tr>
            <td colspan="2" align="center">
                <p><input type="submit" value="Submit" class="inputButton" /></p>
            </td>
        </tr>

    </table>
    <input type="hidden" name="is_submitted" value="yes"/>
    </form>
</body>
</html>