/
getTransactionDetailsRequest.php
176 lines (165 loc) · 4.87 KB
/
getTransactionDetailsRequest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
/*
* This file is part of the AuthnetJSON package.
*
* (c) John Conde <stymiee@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*************************************************************************************************
Use the Transaction Details API to get the details of a transaction
SAMPLE REQUEST
--------------------------------------------------------------------------------------------------
{
"getTransactionDetailsRequest":{
"merchantAuthentication":{
"name":"",
"transactionKey":""
},
"transId":"2162566217"
}
}
SAMPLE RESPONSE
--------------------------------------------------------------------------------------------------
{
"transaction":{
"transId":"2162566217",
"submitTimeUTC":"2011-09-01T16:30:49.39Z",
"submitTimeLocal":"2011-09-01T10:30:49.39",
"transactionType":"authCaptureTransaction",
"transactionStatus":"settledSuccessfully",
"responseCode":1,
"responseReasonCode":1,
"responseReasonDescription":"Approval",
"authCode":"JPG9DJ",
"AVSResponse":"Y",
"batch":{
"batchId":"1221577",
"settlementTimeUTC":"2011-09-01T16:38:54.52Z",
"settlementTimeUTCSpecified":true,
"settlementTimeLocal":"2011-09-01T10:38:54.52",
"settlementTimeLocalSpecified":true,
"settlementState":"settledSuccessfully"
},
"order":{
"invoiceNumber":"60",
"description":"Auto-charge for Invoice #60"
},
"requestedAmountSpecified":false,
"authAmount":1018.88,
"settleAmount":1018.88,
"prepaidBalanceRemainingSpecified":false,
"taxExempt":false,
"taxExemptSpecified":true,
"payment":{
"creditCard":{
"cardNumber":"XXXX4444",
"expirationDate":"XXXX",
"cardType":"MasterCard"
}
},
"customer":{
"typeSpecified":false,
"id":"4"
},
"billTo":{
"phoneNumber":"(619) 274-0494",
"firstName":"Matteo",
"lastName":"Bignotti",
"address":"625 Broadway\nSuite 1025",
"city":"San Diego",
"state":"CA",
"zip":"92101",
"country":"United States"
},
"recurringBilling":false,
"recurringBillingSpecified":true,
"product":"Card Not Present",
"marketType":"eCommerce"
},
"messages":{
"resultCode":"Ok",
"message":[
{
"code":"I00001",
"text":"Successful."
}
]
}
}
*************************************************************************************************/
namespace Authnetjson;
use Exception;
require '../../config.inc.php';
try {
$request = AuthnetApiFactory::getJsonApiHandler(
AUTHNET_LOGIN,
AUTHNET_TRANSKEY,
AuthnetApiFactory::USE_DEVELOPMENT_SERVER
);
$response = $request->getTransactionDetailsRequest([
'transId' => '40067511400'
]);
} catch (Exception $e) {
echo $e;
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Transaction Detail :: Transaction Details</title>
<style>
table { border: 1px solid #cccccc; margin: auto; border-collapse: collapse; max-width: 90%; }
table td { padding: 3px 5px; vertical-align: top; border-top: 1px solid #cccccc; }
pre { white-space: pre-wrap; }
table th { background: #e5e5e5; color: #666666; }
h1, h2 { text-align: center; }
</style>
</head>
<body>
<h1>
Transaction Detail :: Transaction Details
</h1>
<h2>
Results
</h2>
<table>
<tr>
<th>Response</th>
<td><?= $response->messages->resultCode ?></td>
</tr>
<tr>
<th>Successful?</th>
<td><?= $response->isSuccessful() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<th>Error?</th>
<td><?= $response->isError() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<th>Code</th>
<td><?= $response->messages->message[0]->code ?></td>
</tr>
<tr>
<th>Message</th>
<td><?= $response->messages->message[0]->text ?></td>
</tr>
<tr>
<th>Transaction</th>
<td>
<b>ID</b>: <?php echo $response->transaction->transId; ?><br>
<b>Type</b>: <?php echo $response->transaction->transactionType; ?><br>
<b>Status</b>: <?php echo $response->transaction->transactionStatus; ?><br>
<b>Authorization Code</b>: <?php echo $response->transaction->authCode; ?><br>
<b>AVS Response</b>: <?php echo $response->transaction->AVSResponse; ?><br>
</td>
</tr>
</table>
<h2>
Raw Input/Output
</h2>
<?= $request, $response ?>
</body>
</html>