Skip to content

Commit 229365d

Browse files
committed
Merge pull request #3 from Gufran/fix/documentation
fixed formatting in documentations
2 parents 685681d + 88ac490 commit 229365d

File tree

8 files changed

+133
-43
lines changed

8 files changed

+133
-43
lines changed

doc/AIM.markdown

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,45 @@ to the results of the transaction.
1212

1313
Including the SDK
1414
-----------------
15-
15+
```
1616
require_once 'anet_php_sdk/AuthorizeNet.php';
17+
```
1718

1819
Setting Merchant Credentials
1920
----------------------------
2021
The easiest way to set credentials is to define constants which the SDK uses:
22+
23+
```
2124
define("AUTHORIZENET_API_LOGIN_ID", "YOURLOGIN");
2225
define("AUTHORIZENET_TRANSACTION_KEY", "YOURKEY");
26+
```
2327

2428
You can also set credentials manually per request like so:
2529

30+
```
2631
$sale = new AuthorizeNetAIM("YOUR_API_LOGIN_ID","YOUR_TRANSACTION_KEY");
27-
32+
```
2833

2934
Setting the Transaction Post Location
3035
-------------------------------------
3136

3237
To post transactions to the live Authorize.Net gateway:
38+
39+
```
3340
define("AUTHORIZENET_SANDBOX", false);
41+
```
3442

3543
To post transactions to the Authorize.Net test server:
44+
45+
```
3646
define("AUTHORIZENET_SANDBOX", true);
47+
```
3748

3849
You can also set the location manually per request:
39-
$sale->setSandbox(false);
4050

51+
```
52+
$sale->setSandbox(false);
53+
```
4154

4255
Setting Fields
4356
--------------
@@ -47,17 +60,22 @@ allows you to set these fields in a few different ways depending on your
4760
preference.
4861

4962
Note: to make things easier on the developer, the "x_" prefix attached to each
50-
field in the AIM API has been removed. Thus, instead of setting $sale->x_card_num,
51-
set $sale->card_num instead.
63+
field in the AIM API has been removed. Thus, instead of setting `$sale->x_card_num`,
64+
set `$sale->card_num` instead.
5265

5366
1.) By Setting Fields Directly:
67+
68+
```
5469
$sale = new AuthorizeNetAIM;
5570
$sale->amount = "1999.99";
5671
$sale->card_num = '6011000000000012';
5772
$sale->exp_date = '04/15';
5873
$response = $sale->authorizeAndCapture();
74+
```
5975

6076
2.) By Setting Multiple Fields at Once:
77+
78+
```
6179
$sale = new AuthorizeNetAIM;
6280
$sale->setFields(
6381
array(
@@ -66,12 +84,15 @@ $sale->setFields(
6684
'exp_date' => '0415'
6785
)
6886
);
87+
```
6988

7089
3.) By Setting Special Items
7190

7291
To add line items or set custom fields use the respective functions:
7392

7493
Line Items:
94+
95+
```
7596
$sale->addLineItem(
7697
'item1', // Item Id
7798
'Golf tees', // Item Name
@@ -80,14 +101,18 @@ $sale->addLineItem(
80101
'5.00', // Item Unit Price
81102
'N' // Item taxable
82103
);
104+
```
83105

84106
Custom Fields:
107+
108+
```
85109
$sale->setCustomField("coupon_code", "SAVE2011");
110+
```
86111

87112
4.) By Passing in Objects
88-
89113
Each property will be copied from the object to the AIM request.
90114

115+
```
91116
$sale = new AuthorizeNetAIM;
92117
$customer = (object)array();
93118
$customer->first_name = "Jane";
@@ -104,17 +129,20 @@ $customer->email = "[email protected]";
104129
$customer->cust_id = "55";
105130
$customer->customer_ip = "98.5.5.5";
106131
$sale->setFields($customer);
132+
```
107133

108134
Submitting Transactions
109135
-----------------------
110136
To submit a transaction call one of the 7 methods:
111137

138+
```
112139
-authorizeAndCapture()
113140
-authorizeOnly()
114141
-priorAuthCapture()
115142
-void()
116143
-captureOnly()
117144
-credit()
145+
```
118146

119147
Each method has optional parameters which highlight the fields required by the
120148
Authorize.Net API for that transaction type.
@@ -125,6 +153,7 @@ eCheck
125153
To submit an electronic check transaction you can set the required fields individually
126154
or simply use the setECheck method:
127155

156+
```
128157
$sale = new AuthorizeNetAIM;
129158
$sale->amount = "45.00";
130159
$sale->setECheck(
@@ -136,25 +165,30 @@ $sale->setECheck(
136165
'WEB' // echeck_type
137166
);
138167
$response = $sale->authorizeAndCapture();
168+
```
139169

140170

141171
Partial Authorization Transactions
142172
----------------------------------
143173
To enable partial authorization transactions set the partial_auth flag
144174
to true:
145175

176+
```
146177
$sale->allow_partial_auth = true;
178+
```
147179

148180
You should receive a split tender id in the response if a partial auth
149181
is made:
150182

183+
```
151184
$split_tender_id = $response->split_tender_id;
152-
185+
```
153186

154187
Itemized Order Information
155188
--------------------------
156189
To add itemized order information use the addLineItem method:
157190

191+
```
158192
$auth->addLineItem(
159193
'item1', // Item Id
160194
'Golf tees', // Item Name
@@ -163,25 +197,27 @@ $auth->addLineItem(
163197
'5.00', // Item Unit Price
164198
'N' // Item taxable
165199
);
166-
200+
```
167201

168202
Merchant Defined Fields
169203
-----------------------
170204
You can use the setCustomField method to set any custom merchant defined field(s):
171205

206+
```
172207
$sale->setCustomField("entrance_source", "Search Engine");
173208
$sale->setCustomField("coupon_code", "SAVE2011");
174-
209+
```
175210

176211
Transaction Response
177212
--------------------
178213
When you submit an AIM transaction you receive an AuthorizeNetAIM_Response
179214
object in return. You can access each name/value pair in the response as
180215
you would normally expect:
181216

217+
```
182218
$response = $sale->authorizeAndCapture();
183219
$response->response_code;
184220
$response->response_subcode;
185221
$response->response_reason_code;
186222
$response->transaction_id;
187-
223+
```

doc/ARB.markdown

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ Basic Overview
77
The AuthorizeNetARB class creates a request object for submitting transactions
88
to the AuthorizeNetARB API.
99

10-
1110
Creating/Updating Subscriptions
1211
-------------------------------
13-
1412
To create or update a subscription first create a subscription object:
1513

14+
```
1615
$subscription = new AuthorizeNet_Subscription;
1716
$subscription->name = "Short subscription";
1817
$subscription->intervalLength = "1";
@@ -25,28 +24,37 @@ $subscription->creditCardExpirationDate = "2018-10";
2524
$subscription->creditCardCardCode = "123";
2625
$subscription->billToFirstName = "john";
2726
$subscription->billToLastName = "doe";
27+
```
2828

2929
Then create an AuthorizeNetARB object and call the appropriate method
3030
passing in your subscription object:
3131

32+
```
3233
$request = new AuthorizeNetARB;
3334
$response = $request->createSubscription($subscription);
35+
```
3436

35-
or for updating a subscription:
37+
or for updating a subscription:
3638

39+
```
3740
$response = $request->updateSubscription($subscription_id, $subscription);
41+
```
3842

3943
Getting Subscription Status
4044
---------------------------
4145

4246
Create a new AuthorizeNetARB object and call the getSubscriptionStatus
4347
method with the subscription_id you want the status of as the parameter:
4448

49+
```
4550
$status_request = new AuthorizeNetARB;
4651
$status_response = $status_request->getSubscriptionStatus($subscription_id);
52+
```
4753

4854
Canceling a Subscription
4955
------------------------
5056

57+
```
5158
$cancellation = new AuthorizeNetARB;
5259
$cancel_response = $cancellation->cancelSubscription($subscription_id);
60+
```

0 commit comments

Comments
 (0)