Prev | Current Page 753 | Next

Emilian Balanescu and Cristian Darie

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

If the authorization is successful, we can then use this transaction ID to perform a PRIOR_AUTH_CAPTURE
transaction, which effectively takes the money from the customer??™s account.
As explained earlier, the response from Authorize.net comes in the form of a string that contains values delimited
by a configurable character, which, in our case, is the pipe character (|). To read a particular value from the string,
we transform the string into an array using the explode() PHP function (http://www.php.net/manual/en/
function.explode.php):
$auth_only_response = $request->GetResponse();
$_SESSION['auth_only_response'] = $auth_only_response;
$auth_only_response = explode('|', $auth_only_response);
After this piece of code executes, $auth_only_response will contain an array whose elements are the values
that were delimited by the pipe character in the original string. From this array, we??™re interested in the seventh
element, which, according to the Authorize.net documentation, is the transaction ID (read the Gateway Response
API details from http://www.authorize.net/support/AIM_guide.pdf for the complete details about the
Authorize.net response).
// Read the transaction ID, which will be necessary for taking the payment
$ref_trans_id = $auth_only_response[6];
?– Note The $auth_only_response array created by explode() is zero based, so
$auth_only_response[6] represents the seventh element of the array.


Pages:
741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765
drukarki fiskalne kraków willa karmazyn międzyzdroje www.books61.hobbitstory.com terapia magnetyczna Informacje o hostingu