forked from AuthorizeNet/sdk-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.html
358 lines (331 loc) · 32.9 KB
/
README.html
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang='en'>
<head>
<title> PHP SDK README </title>
<style type="text/css">
body {
min-width: 768px;
font-family: "Helvetica Neue","Lucida Grande","Segoe UI",Arial,Helvetica,Verdana,sans-serif;
color: #333333;
font-size: 0.8em;
}
code {
font-family: 'Courier New';
font-size: 1.0em;
color: #000000;
background-color: #f1f1f1;
white-space: pre;
line-height: 1;
display: block;
margin-left: 3%;
margin-right: 3%;
padding: 10px;
}
table {
border-collapse: collapse;
width: 94%;
margin: 3%;
margin-right: 3%;
margin-top: 0px;
margin-bottom: 0px;
}
td {
padding: 3px;
border: solid 1px #cccccc;
}
ul {
margin-top: 0px;
}
h1,h2,h3,h6 {
margin: 0px;
padding: 0px;
text-align: center;
}
h4,h5 {
margin-bottom: 0px;
padding-bottom: 5px;
}
.indent {
display: block;
margin-left: 3%;
}
.sc0 {
font-weight: bold;
}
.sc18 {
color: #FF0000;
}
.sc119 {
color: #808080;
}
.sc120 {
color: #808080;
}
.sc121 {
font-weight: bold;
color: #0000FF;
}
.sc123 {
color: #000080;
}
.sc125 {
color: #008000;
}
.sc127 {
color: #8000FF;
}
</style>
</head>
<body>
<h1>Authorize.Net PHP SDK</h1>
<h2>version 3.1.2</h2>
<h6><a href='http://developer.authorize.net'>http://developer.authorize.net</a></h6>
<h6><a href='http://community.developer.authorize.net'>http://community.developer.authorize.net</a></h6>
<br/>
<h4>License</h4>
<span class='indent'>Authorize.Net<br />
See <a href='./License.pdf'>License.pdf</a>
</span>
<br/>
<h4>About</h4>
<span class='indent'>A PHP library for working with all Authorize.Net APIs.
</span>
<br/>
<h4>Files</h4>
<table>
<tr><td>Authorize.Net.php</td><td>Includes all classes. Include this file in your project.</td></tr>
<tr><td>AuthorizeNet.php</td><td>Includes all classes. Include this file in your project.</td></tr>
<tr><td>lib/AuthorizeNetAIM.php</td><td>AIM API.</td></tr>
<tr><td>lib/AuthorizeNetARB.php</td><td>-> ARB API.</td></tr>
<tr><td>lib/AuthorizeNetCIM.php</td><td>CIM API.</td></tr>
<tr><td>lib/AuthorizeNetSIM.php</td><td>SIM API.</td></tr>
<tr><td>lib/AuthorizeNetTD.php</td><td>Reporting API.</td></tr>
<tr><td>lib/AuthorizeNetCP.php</td><td>Card Present API.</td></tr>
<tr><td>lib/AuthorizeNetDPM.php</td><td>Direct Post Method Helpers.</td></tr>
<tr><td>lib/AuthorizeNetSOAP.php</td><td>Class to assist with using the SOAP API.</td></tr>
<tr><td>lib/shared/AuthorizeNetRequest.php</td><td>Class to connect to AuthorizeNet.</td></tr>
<tr><td>lib/shared/AuthorizeNetTypes.php</td><td>Classes for AuthorizeNet Datatypes.</td></tr>
<tr><td>lib/shared/AuthorizeNetResponse.php</td><td>Class to parse AuthorizeNet NVP Responses.</td></tr>
<tr><td>lib/shared/AuthorizeNetXMLResponse.php</td><td>Class to parse AuthorizeNet XML Responses.</td></tr>
<tr><td>lib/ssl/cert.pem</td><td>The AuthorizeNet Certificate bundle.</td></tr>
<tr><td>tests/</td><td>Tests & examples for each of the API methods.</td></tr>
<tr><td>README</td><td>Plain text version of this file.</td></tr>
<tr><td>README.html</td><td>This file.</td></tr>
</table>
<br />
<h4>Requirements</h4>
<ul>
<li>cURL PHP Extension</li>
<li>PHP 5.2+</li>
<li>An Authorize.Net Merchant Account or Test Account. You can get a free test account at <a href='http://developer.authorize.net/testaccount/'>http://developer.authorize.net/testaccount/</a></li>
</ul>
<h4>Install</h4>
<ul>
<li>Include the 'AuthorizeNet.php' file in your application.
<li>Use your desired API.
</ul>
<h4>Usage Examples:</h4>
<span class='indent'>See below for basic usage examples. View the tests/ folder for more examples of each API.</span>
<h5>AuthorizeNetAIM.php Quick Usage Example</h5>
<code><span class="sc18"><?php</span><span class="sc118">
</span><span class="sc121">require_once</span><span class="sc118"> </span><span class="sc120">'anet_php_sdk/AuthorizeNet.php'</span><span class="sc127">;</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_API_LOGIN_ID"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURLOGIN"</span><span class="sc127">);</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_TRANSACTION_KEY"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURKEY"</span><span class="sc127">);</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_SANDBOX"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc121">true</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc123">$sale</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc121">new</span><span class="sc118"> AuthorizeNetAIM</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$sale</span><span class="sc127">-></span><span class="sc118">amount </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"5.99"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$sale</span><span class="sc127">-></span><span class="sc118">card_num </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc120">'6011000000000012'</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$sale</span><span class="sc127">-></span><span class="sc118">exp_date </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc120">'04/15'</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$response</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$sale</span><span class="sc127">-></span><span class="sc118">authorizeAndCapture</span><span class="sc127">();</span><span class="sc118">
</span><span class="sc121">if</span><span class="sc118"> </span><span class="sc127">(</span><span class="sc123">$response</span><span class="sc127">-></span><span class="sc118">approved</span><span class="sc127">)</span><span class="sc118"> </span><span class="sc127">{</span><span class="sc118">
</span><span class="sc123">$transaction_id</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$response</span><span class="sc127">-></span><span class="sc118">transaction_id</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc127">}</span><span class="sc118">
</span><span class="sc18">?></span><span class="sc0"></span>
</code>
<h5>AuthorizeNetAIM.php Advanced Usage Example</h5>
<code><span class="sc18"><?php</span><span class="sc118">
</span><span class="sc121">require_once</span><span class="sc118"> </span><span class="sc120">'anet_php_sdk/AuthorizeNet.php'</span><span class="sc127">;</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_API_LOGIN_ID"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURLOGIN"</span><span class="sc127">);</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_TRANSACTION_KEY"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURKEY"</span><span class="sc127">);</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_SANDBOX"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc121">true</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc123">$auth</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc121">new</span><span class="sc118"> AuthorizeNetAIM</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$auth</span><span class="sc127">-></span><span class="sc118">amount </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"45.00"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc125">// Use eCheck:</span><span class="sc118">
</span><span class="sc123">$auth</span><span class="sc127">-></span><span class="sc118">setECheck</span><span class="sc127">(</span><span class="sc118">
</span><span class="sc120">'121042882'</span><span class="sc127">,</span><span class="sc118">
</span><span class="sc120">'123456789123'</span><span class="sc127">,</span><span class="sc118">
</span><span class="sc120">'CHECKING'</span><span class="sc127">,</span><span class="sc118">
</span><span class="sc120">'Bank of Earth'</span><span class="sc127">,</span><span class="sc118">
</span><span class="sc120">'Jane Doe'</span><span class="sc127">,</span><span class="sc118">
</span><span class="sc120">'WEB'</span><span class="sc118">
</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc125">// Set multiple line items:</span><span class="sc118">
</span><span class="sc123">$auth</span><span class="sc127">-></span><span class="sc118">addLineItem</span><span class="sc127">(</span><span class="sc120">'item1'</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc120">'Golf tees'</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc120">'Blue tees'</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc120">'2'</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc120">'5.00'</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc120">'N'</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc123">$auth</span><span class="sc127">-></span><span class="sc118">addLineItem</span><span class="sc127">(</span><span class="sc120">'item2'</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc120">'Golf shirt'</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc120">'XL'</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc120">'1'</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc120">'40.00'</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc120">'N'</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc125">// Set Invoice Number:</span><span class="sc118">
</span><span class="sc123">$auth</span><span class="sc127">-></span><span class="sc118">invoice_num </span><span class="sc127">=</span><span class="sc118"> time</span><span class="sc127">();</span><span class="sc118">
</span><span class="sc125">// Set a Merchant Defined Field:</span><span class="sc118">
</span><span class="sc123">$auth</span><span class="sc127">-></span><span class="sc118">setCustomField</span><span class="sc127">(</span><span class="sc119">"entrance_source"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"Search Engine"</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc125">// Authorize Only:</span><span class="sc118">
</span><span class="sc123">$response</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$auth</span><span class="sc127">-></span><span class="sc118">authorizeOnly</span><span class="sc127">();</span><span class="sc118">
</span><span class="sc121">if</span><span class="sc118"> </span><span class="sc127">(</span><span class="sc123">$response</span><span class="sc127">-></span><span class="sc118">approved</span><span class="sc127">)</span><span class="sc118"> </span><span class="sc127">{</span><span class="sc118">
</span><span class="sc123">$auth_code</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$response</span><span class="sc127">-></span><span class="sc118">transaction_id</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc125">// Now capture:</span><span class="sc118">
</span><span class="sc123">$capture</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc121">new</span><span class="sc118"> AuthorizeNetAIM</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$capture_response</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$capture</span><span class="sc127">-></span><span class="sc118">priorAuthCapture</span><span class="sc127">(</span><span class="sc123">$auth_code</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc125">// Now void:</span><span class="sc118">
</span><span class="sc123">$void</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc121">new</span><span class="sc118"> AuthorizeNetAIM</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$void_response</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$void</span><span class="sc127">-></span><span class="sc118">void</span><span class="sc127">(</span><span class="sc123">$capture_response</span><span class="sc127">-></span><span class="sc118">transaction_id</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc127">}</span><span class="sc118">
</span><span class="sc18">?></span><span class="sc0"></span>
</code>
<h5>AuthorizeNetARB.php Usage Example</h5>
<code><span class="sc18"><?php</span><span class="sc118">
</span><span class="sc121">require_once</span><span class="sc118"> </span><span class="sc120">'anet_php_sdk/AuthorizeNet.php'</span><span class="sc127">;</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_API_LOGIN_ID"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURLOGIN"</span><span class="sc127">);</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_TRANSACTION_KEY"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURKEY"</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc123">$subscription</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc121">new</span><span class="sc118"> AuthorizeNet_Subscription</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$subscription</span><span class="sc127">-></span><span class="sc118">name </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"PHP Monthly Magazine"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$subscription</span><span class="sc127">-></span><span class="sc118">intervalLength </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"1"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$subscription</span><span class="sc127">-></span><span class="sc118">intervalUnit </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"months"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$subscription</span><span class="sc127">-></span><span class="sc118">startDate </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"2011-03-12"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$subscription</span><span class="sc127">-></span><span class="sc118">totalOccurrences </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"12"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$subscription</span><span class="sc127">-></span><span class="sc118">amount </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"12.99"</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc123">$subscription</span><span class="sc127">-></span><span class="sc118">creditCardCardNumber </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"6011000000000012"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$subscription</span><span class="sc127">-></span><span class="sc118">creditCardExpirationDate</span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"2018-10"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$subscription</span><span class="sc127">-></span><span class="sc118">creditCardCardCode </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"123"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$subscription</span><span class="sc127">-></span><span class="sc118">billToFirstName </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"Rasmus"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$subscription</span><span class="sc127">-></span><span class="sc118">billToLastName </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"Doe"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc125">// Create the subscription.</span><span class="sc118">
</span><span class="sc123">$request</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc121">new</span><span class="sc118"> AuthorizeNetARB</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$response</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$request</span><span class="sc127">-></span><span class="sc118">createSubscription</span><span class="sc127">(</span><span class="sc123">$subscription</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc123">$subscription_id</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$response</span><span class="sc127">-></span><span class="sc118">getSubscriptionId</span><span class="sc127">();</span><span class="sc118">
</span><span class="sc18">?></span><span class="sc0"></span>
</code>
<h5>AuthorizeNetCIM.php Usage Example</h5>
<code><span class="sc18"><?php</span><span class="sc118">
</span><span class="sc121">require_once</span><span class="sc118"> </span><span class="sc120">'anet_php_sdk/AuthorizeNet.php'</span><span class="sc127">;</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_API_LOGIN_ID"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURLOGIN"</span><span class="sc127">);</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_TRANSACTION_KEY"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURKEY"</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc123">$request</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc121">new</span><span class="sc118"> AuthorizeNetCIM</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc125">// Create new customer profile</span><span class="sc118">
</span><span class="sc123">$customerProfile</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc121">new</span><span class="sc118"> AuthorizeNetCustomer</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$customerProfile</span><span class="sc127">-></span><span class="sc118">description </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"Description of customer"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$customerProfile</span><span class="sc127">-></span><span class="sc118">merchantCustomerId</span><span class="sc127">=</span><span class="sc118"> time</span><span class="sc127">();</span><span class="sc118">
</span><span class="sc123">$customerProfile</span><span class="sc127">-></span><span class="sc118">email </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"[email protected]"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$response</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$request</span><span class="sc127">-></span><span class="sc118">createCustomerProfile</span><span class="sc127">(</span><span class="sc123">$customerProfile</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc121">if</span><span class="sc118"> </span><span class="sc127">(</span><span class="sc123">$response</span><span class="sc127">-></span><span class="sc118">isOk</span><span class="sc127">())</span><span class="sc118"> </span><span class="sc127">{</span><span class="sc118">
</span><span class="sc123">$customerProfileId</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$response</span><span class="sc127">-></span><span class="sc118">getCustomerProfileId</span><span class="sc127">();</span><span class="sc118">
</span><span class="sc127">}</span><span class="sc118">
</span><span class="sc18">?></span><span class="sc0"></span>
</code>
<h5>AuthorizeNetSIM.php Usage Example</h5>
<code><span class="sc18"><?php</span><span class="sc118">
</span><span class="sc121">require_once</span><span class="sc118"> </span><span class="sc120">'anet_php_sdk/AuthorizeNet.php'</span><span class="sc127">;</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_API_LOGIN_ID"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURLOGIN"</span><span class="sc127">);</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_MD5_SETTING"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">""</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc123">$message</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc121">new</span><span class="sc118"> AuthorizeNetSIM</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc121">if</span><span class="sc118"> </span><span class="sc127">(</span><span class="sc123">$message</span><span class="sc127">-></span><span class="sc118">isAuthorizeNet</span><span class="sc127">())</span><span class="sc118"> </span><span class="sc127">{</span><span class="sc118">
</span><span class="sc123">$transactionId</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$message</span><span class="sc127">-></span><span class="sc118">transaction_id</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc127">}</span><span class="sc118">
</span><span class="sc18">?></span><span class="sc0"></span>
</code>
<h5>AuthorizeNetDPM.php Usage Example</h5>
<code><span class="sc18"><?php</span><span class="sc118"> </span><span class="sc125">// Filename: direct_post.php</span><span class="sc118">
</span><span class="sc121">require_once</span><span class="sc118"> </span><span class="sc120">'anet_php_sdk/AuthorizeNet.php'</span><span class="sc127">;</span><span class="sc118"> </span><span class="sc125">// The SDK</span><span class="sc118">
</span><span class="sc123">$url</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"http://YOUR_DOMAIN.com/direct_post.php"</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$api_login_id</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc120">'YOUR_API_LOGIN_ID'</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$transaction_key</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc120">'YOUR_TRANSACTION_KEY'</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$md5_setting</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc120">'YOUR_MD5_SETTING'</span><span class="sc127">;</span><span class="sc118"> </span><span class="sc125">// Your MD5 Setting</span><span class="sc118">
</span><span class="sc123">$amount</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc119">"5.99"</span><span class="sc127">;</span><span class="sc118">
AuthorizeNetDPM</span><span class="sc127">::</span><span class="sc118">directPostDemo</span><span class="sc127">(</span><span class="sc123">$url</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc123">$api_login_id</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc123">$transaction_key</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc123">$amount</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc123">$md5_setting</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc18">?></span><span class="sc0"></span>
</code>
<h5>AuthorizeNetCP.php Usage Example</h5>
<code><span class="sc18"><?php</span><span class="sc118">
</span><span class="sc121">require_once</span><span class="sc118"> </span><span class="sc120">'anet_php_sdk/AuthorizeNet.php'</span><span class="sc127">;</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_API_LOGIN_ID"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURLOGIN"</span><span class="sc127">);</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_TRANSACTION_KEY"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURKEY"</span><span class="sc127">);</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_MD5_SETTING"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">""</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc123">$sale</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc121">new</span><span class="sc118"> AuthorizeNetCP</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$sale</span><span class="sc127">-></span><span class="sc118">amount </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc120">'59.99'</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$sale</span><span class="sc127">-></span><span class="sc118">device_type </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc120">'4'</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$sale</span><span class="sc127">-></span><span class="sc118">setTrack1Data</span><span class="sc127">(</span><span class="sc120">'%B4111111111111111^CARDUSER/JOHN^1803101000000000020000831000000?'</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc123">$response</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$sale</span><span class="sc127">-></span><span class="sc118">authorizeAndCapture</span><span class="sc127">();</span><span class="sc118">
</span><span class="sc123">$trans_id</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$response</span><span class="sc127">-></span><span class="sc118">transaction_id</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc18">?></span><span class="sc0"></span>
</code>
<h5>AuthorizeNetTD.php Usage Example</h5>
<code><span class="sc18"><?php</span><span class="sc118">
</span><span class="sc121">require_once</span><span class="sc118"> </span><span class="sc120">'anet_php_sdk/AuthorizeNet.php'</span><span class="sc127">;</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_API_LOGIN_ID"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURLOGIN"</span><span class="sc127">);</span><span class="sc118">
define</span><span class="sc127">(</span><span class="sc119">"AUTHORIZENET_TRANSACTION_KEY"</span><span class="sc127">,</span><span class="sc118"> </span><span class="sc119">"YOURKEY"</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc123">$request</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc121">new</span><span class="sc118"> AuthorizeNetTD</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc123">$response</span><span class="sc118"> </span><span class="sc127">=</span><span class="sc118"> </span><span class="sc123">$request</span><span class="sc127">-></span><span class="sc118">getTransactionDetails</span><span class="sc127">(</span><span class="sc119">"12345"</span><span class="sc127">);</span><span class="sc118">
</span><span class="sc121">echo</span><span class="sc118"> </span><span class="sc123">$response</span><span class="sc127">-></span><span class="sc118">xml</span><span class="sc127">-></span><span class="sc118">transaction</span><span class="sc127">-></span><span class="sc118">transactionStatus</span><span class="sc127">;</span><span class="sc118">
</span><span class="sc18">?></span>
</code>
<br />
<h4>Test Credit Card Numbers</h4>
<table>
<tr><td>American Express Test Card</td><td>370000000000002</td></tr>
<tr><td>Discover Test Card</td><td>6011000000000012</td></tr>
<tr><td>Visa Test Card</td><td>4007000000027</td></tr>
<tr><td>Second Visa Test Card</td><td>4012888818888</td></tr>
<tr><td>JCB</td><td>3088000000000017</td></tr>
<tr><td>Diners Club/ Carte Blanche</td><td>38000000000006</td></tr>
</table>
<span class='indent'><small>Set the expiration date to anytime in the future.</small></span>
<br />
<h4>PHPDoc:</h4>
<span class='indent'>To autogenerate PHPDocs run</span>
<code>phpdoc -t phpdocs/ -f AuthorizeNet.php -d lib</code>
<h4>Release Notes</h4>
<span class='indent'>
<em>Version 1.1.8</em>
<ul>
<li>
Fixed an issue with validationMode in CIM::updateCustomerPaymentProfile. Note: The behavior where validationMode persisted across transactions using the same request object has been removed. This was unsupported behavior.
</li>
<li>
Removed an unused validationMode argument in CIM::updateCustomerProfile. The parameter used to be ignored, now its removed.
</li>
<li>
Enhanced the tests with checks for single digit months in expiration date support and SSL certificate validity.
</li>
</ul>
<em>Version 1.1.7</em>
<ul>
<li>Added getBatchStatisticsRequest and getUnsettledTransactionListRequest support to the SDK.</li>
</ul>
<em>Version 1.1.6</em>
<ul>
<li>Added the HTML version of the README to the distributed bundle. It was missing in version 1.1.5.</li>
</ul>
<em>Version 1.1.5</em>
<ul>
<li>Added HTML version of README.</li>
</ul>
<em>Version 1.1.4</em>
<ul>
<li>Updated the cert.pem bundle to include the new secure.authorize.net SSL certificate.</li>
</ul>
<em>Version 1.1.3</em>
<ul>
<li>Added more documentation</li>
<li>Improved support for all Transaction Details API methods.</li>
<li>Added support for the Card Present API.</li>
<li>Added easier xpath support to XML Response class.</li>
<li>Added ability to use DPM sample app with production account.</li>
</ul>
<em>Version 1.1.2</em>
<ul>
<li>Added getValidationResponses method to CIM Response for parsing the validation results when validating payment profiles.</li>
<li>Added support for UpdateSplitTenderGroup method to CIM request.</li>
<li>Bug fix. In CIM requests using validation mode the the validation mode element should have been added to the end of the request.</li>
<li>Bug fix. In AIM Response class where $response->account_number was returning the wrong value.</li>
</ul>
</span>
</body>
</html>