PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Mayor Brain   Visa Payment Gateway Integration   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Visa Payment Gateway Integration
Send payment requests to a payment gateway
Author: By
Last change:
Date: 12 years ago
Size: 1,155 bytes
 

Contents

Class file image Download
<?php

/**
This is an example file on how to use the Visa payment gateway integration package
*/
//NOTE: 1) You must have set up your stunnel server. 2) You must have configured the appropraite URLS in Visa.php
require_once ('Visa.php');

$reference_code = "1002323554";//transaction reference code
$amount = 2000;//amount you are charging to visa card
$description = "Payment for Gift Voucher";//description of transaction

$customer_email = "customer@mailer.com";
$customer_phone = "8034423288";

//initialise the VISA payment gateway connection

$visa = Visa::ini('MERCHANT ID',$reference_code);

//create order

$order = $visa->createOrder($amount,$description,$customer_email,$customer_phone);

/************End of Step 1, the next step is the check the status of your order******************/

//check status of order (this is after VISA has redirected to your APPROVAL_URL or DECLINE_URL)
$visa = Visa::ini('MERCHANT ID',$reference_code);
$orderStatus = $visa->getOrderStatus();

if(
$orderStatus->isApproved())echo "Transaction was successful";
if(
$orderStatus->isDeclined())echo "Transaction was not successful";
?>