The code that takes the money using this transaction ID is straightforward. Because the transaction has already
been authorized, we only need to specify the transaction ID received after authorization to complete the transaction:
// 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();
Integrating Authorize.net with TShirtShop
As with DataCash, we??™ll have to modify the PsCheckFunds and PsTakePayment classes to use the
new Authorize.net functionality.
CHAPTER 20 ?– PROCESSING CREDIT CARD TRANSACTIONS 649
Remember that you can use the files from the Source Code/Download section of the Apress
web site (http://www.apress.com/) instead of typing the code yourself.
The final modifications involve changing the pipeline section classes that deal with
credit card transactions (PsCheckFunds and PsTakePayment). We??™ve already included the
infrastructure for storing and retrieving authentication code and reference information
via the OrderProcessor::SetOrderAuthCodeAndReference() method.
Exercise: Implementing the Order Pipeline Classes
1. First, modify business/ps_check_funds.php to work with Authorize.net. You may back up the DataCash
version of this file, if you followed the DataCash exercise earlier in this chapter.
Pages:
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766