Skip to content

Instantly share code, notes, and snippets.

@inxilpro
Created March 18, 2010 19:23
Show Gist options
  • Save inxilpro/336759 to your computer and use it in GitHub Desktop.
Save inxilpro/336759 to your computer and use it in GitHub Desktop.
<?php
$options = array(
'loginId' => 'Authorize.net Login ID',
'transactionKey' => 'Authorize.net Transaction Key',
'mode' => 'test'
);
$gateway = Galahad_Payment::factory('AuthorizeNet', $options);
$customer = new Galahad_Payment_Customer(array(
'firstName' => 'John',
'lastName' => 'Smith',
'postalCode' => '19106',
));
$card = new Galahad_Payment_Method_CreditCard('4111111111111111', 11, 2012);
$transaction = new Galahad_Payment_Transaction();
$transaction->setBillingCustomer($customer);
$transaction->setPaymentMethod($card);
$transaction->setAmount(3.50);
$transaction->setComments("I need about three-fiddy.");
$response = $gateway->process($transaction);
if ($response->isApproved()) {
echo "Your transaction was approved!";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment