Location: PHPKode > scripts > AIM classes > aim-classes/AIM-sample.php
#!/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("hide@address.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";
?>
Return current item: AIM classes