PHP Classes
elePHPant
Icontem

File: Demo

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of njau ndirangu  >  AuthNetAim  >  Demo  >  Download  
File: Demo
Role: Example script
Content type: text/plain
Description: AIM demo
Class: AuthNetAim
Process payments using the Authorize.net gateway
Author: By
Last change:
Date: 6 years ago
Size: 1,624 bytes
 

Contents

Class file image Download

<?php
//send the information to authorize.net for further validation
   //include the authorize.net class
 
require_once($_SERVER['DOCUMENT_ROOT'].
             
'/classes/clsCCauthorize.php');
      
      
$aim=new AuthNetAim();
      
//$aim->x_url="https://api.authorize.net/xml/v1/requestweb.api";
      
$aim->url="https://test.authorize.net/gateway/transact.dll";
     
//$aim->x_url="https://certification.authorize.net/gateway/transact.dll";
       //$aim->x_url="http://developer.authorize.net/testaccount";
      
$aim->x_login="XXXXXXXXXXXXXXXX";
      
$aim->x_tran_key="XXXXXXXXXXXXXXX";
      
$aim->x_version="3.1";
      
$aim->x_type="AUTH_ONLY";
      
$aim->x_test_request="FALSE";
      
$aim->x_card_num=trim($_POST['card_no']);
      
$aim->x_exp_date=trim($_POST['month']).trim($_POST['year']);
      
$aim->x_method="CC";
      
$aim->x_amount="1.01";
      
$aim->x_first_name=$first_name;
      
$aim->x_last_name=$last_name;
      
$aim->x_address=$_POST['address'];
      
$aim->x_city=$_POST['city'];
      
$aim->x_state=$_POST['state'];
      
$aim->x_zip=$_POST['zip'];
      
$aim->x_country=$_POST['country'];
      
$aim->x_email=$_SESSION['email_address'];
      
$aim->x_card_code=$_POST['ccv_no'];
      
$aim->x_delim_char="|";
      
$aim->x_delim_data="TRUE";
      
$aim->x_url="FALSE";
      
$aim->x_invoice_num=$invoice_number;
      
      
      
$error=$aim->process();
      
//debug messages
//$aim->dump_fields(); // outputs all the fields that we set
//$aim->dump_response(); // outputs the response from the payment gateway
?>