Prev | Current Page 751 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

php?step=1">


4. Load the test_authorize_net.php page in your favorite browser to see the results (see Figure 20-3).
Figure 20-3. Authorize.net transaction results
5. Go to Authorize.net, and log in to the Merchant Interface (https://test.authorize.net/). You can see
the transaction you??™ve just performed in the Unsettled Transactions section under the Search tab. This report
is shown in Figure 20-4.
CHAPTER 20 ?–  PROCESSING CREDIT CARD TRANSACTIONS 646
Figure 20-4. Authorize.net Unsettled Transactions
How It Works: Authorize.net Transactions
The hard work is done by the AuthorizeNetRequest class, which has two important methods: SetRequest(),
used to set up transaction details, and GetResponse(), used to send the request to and retrieve the response
from Authorize.net. The following code snippet shows how they are used:
// Auth
$transaction =
array ('x_invoice_num' => '99999', // Invoice number
'x_amount' => '45.99', // Amount
'x_card_num' => '4007000000027', // Credit card number
'x_exp_date' => '1209', // Expiration date
'x_method' => 'CC', // Payment method
'x_type' => 'AUTH_ONLY'); // Transaction type
CHAPTER 20 ?–  PROCESSING CREDIT CARD TRANSACTIONS 647
$request->SetRequest($transaction);
$response = $request->GetResponse();
?– Note The credit card data mentioned in this transaction is one of the magic card numbers provided by
Authorize.


Pages:
739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763
ATC ABBA DMOZ biznes prezenty ubezpieczenia komunikacyjne