Login   Register  
PHP Classes
elePHPant
Icontem

File: AIM-sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Blaine Simpson  >  AIM  >  AIM-sample.php  >  Download  
File: AIM-sample.php
Role: Example script
Content type: text/plain
Description: sample end-user script
Class: AIM
Submit Authorize.net credit card charges
Author: By
Last change:
Date: 8 years ago
Size: 2,022 bytes
 

Contents

Class file image Download
#!/usr/bin/php5 -q

// The AIM class may be used according to the BSD license, as documented
// in AIM.php.

/**
 * Example that uses my AIM class.
 * You need to pur AIM.php and CSVTokenizer.php into your PHP search path.
 */

<?php
    
require_once "AIM.php";
    
$ai = new AIM();
    
$ai->setBillFirstName("Wayne");
    
$ai->setBillLastName("Sampsonite");
    
$ai->setBillOrg("Your Corp.");
    
$ai->setBillAddress("271 Leafy Rd.,   Steptoe Turnoff");
    
$ai->setBillCity("Blueberry Point");
    
$ai->setBillStateName("ND");
    
$ai->setBillZip("11121");
    
$ai->setBillCountry("USA");
    
$ai->setBillPhone("(421)728-6888");
    
$ai->setBillFax("(421)724-1488");
    
$ai->setCustId("501");
    
$ai->setEmail("you@emaildomain.com");
    
$ai->setInvoiceNum("999");
    
$ai->setDescription("Widget(s) purchase");
    
$ai->setShipFirstName("Fran");
    
$ai->setShipLastName("Blesso");
    
$ai->setShipOrg("GCPF Inc.");
    
$ai->setShipAddress("PO Box 54");
    
$ai->setShipCity("Charlesburg");
    
$ai->setShipStateName("SD");
    
$ai->setShipZip("22222");
    
$ai->setShipCountry("US");
    
$ai->setCardCode("123");
    
$ai->setAmount(5123);
    
$ai->setCardNum("4007000000027");  // Test VISA credit card number
                                       // See the AIM docs for test numbers
                                       // for other cards, and for how to
                                       // emulate refusals.
    
$ai->setExp("05/10");
    
$ai->fetch();
    echo 
$ai->toString() . "\n";
    echo 
"=============================================\n";
    echo 
"RCODE: " $ai->getRcode() . "\n";
    echo 
"RRCODE: " $ai->getRRcode() . "\n";
    echo 
"RRTEXT: " $ai->getRRtext() . "\n";
    echo 
"APPROVAL CODE: " $ai->getApproval() . "\n";
    echo 
"AVS RESULT CODE: " $ai->getAVS() . "\n";
    echo 
"TRANS ID: " $ai->getTransId() . "\n";
    echo 
"AMOUNT: " $ai->getAmount() . "\n";
    echo 
"TRANS TYPE: " $ai->getTransType() . "\n";
    
$ai->validateTypical();
    echo 
"\nValidated ok\n";
?>