Prev | Current Page 750 | Next

Emilian Balanescu and Cristian Darie

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

net account:
// Constant definitions for authorize.net
define('AUTHORIZE_NET_URL', 'https://test.authorize.net/gateway/transact.dll');
define('AUTHORIZE_NET_LOGIN_ID', '[Your Login ID]');
define('AUTHORIZE_NET_TRANSACTION_KEY', '[Your Transaction Key]');
define('AUTHORIZE_NET_TEST_REQUEST', 'FALSE');
3. Add the following test_authorize_net.php test file in your site root folder:
session_start();
if (empty ($_GET['step']))
{
require_once 'include/config.php';
require_once BUSINESS_DIR . 'authorize_net_request.php';
$request = new AuthorizeNetRequest(AUTHORIZE_NET_URL);
// 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
$request->SetRequest($transaction);
$auth_only_response = $request->GetResponse();
$_SESSION['auth_only_response'] = $auth_only_response;
$auth_only_response = explode('|', $auth_only_response);
// Read the transaction ID, which will be necessary for taking the payment
$ref_trans_id = $auth_only_response[6];
// Capture
$transaction =
array ('x_ref_trans_id' => $ref_trans_id, // Transaction id
'x_method' => 'CC', // Payment method
'x_type' => 'PRIOR_AUTH_CAPTURE'); // Transaction type
$request->SetRequest($transaction);
$prior_auth_capture_response = $request->GetResponse();
CHAPTER 20 ?–  PROCESSING CREDIT CARD TRANSACTIONS 645
$_SESSION['prior_auth_capture_response'] = $prior_auth_capture_response;
}
else
{
switch ($_GET['step'])
{
case 1:
print $_SESSION['auth_only_response'];
break;
case 2:
print $_SESSION['prior_auth_capture_response'];
break;
}
exit();
}
?>

738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762
Poker Porady Dyskusja Nr1 Grossbritannien - Hotels weltweit poker online zasady pokera