You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -74,12 +73,10 @@ You can run composer locally or on another system to build the directory, then c
74
73
75
74
76
75
## Registration & Configuration
77
-
78
76
Use of this SDK and the Authorize.Net APIs requires having an account on our system. You can find these details in the Settings section.
79
77
If you don't currently have a production Authorize.Net account and need a sandbox account for testing, you can easily sign up for one [here](https://developer.authorize.net/sandbox/).
80
78
81
79
### Authentication
82
-
83
80
To authenticate with the Authorize.Net API you will need to use your account's API Login ID and Transaction Key. If you don't have these values, you can obtain them from our Merchant Interface site. Access the Merchant Interface for production accounts at (https://account.authorize.net/) or sandbox accounts at (https://sandbox.authorize.net).
84
81
85
82
Once you have your keys simply load them into the appropriate variables in your code, as per the below sample code dealing with the authentication part of the API request.
You should never include your Login ID and Transaction Key directly in a PHP file that's in a publically accessible portion of your website. A better practice would be to define these in a constants file, and then reference those constants in the appropriate place in your code.
108
105
109
106
### Switching between the sandbox environment and the production environment
110
-
111
107
Authorize.Net maintains a complete sandbox environment for testing and development purposes. This sandbox environment is an exact duplicate of our production environment with the transaction authorization and settlement process simulated. By default, this SDK is configured to communicate with the sandbox environment. To switch to the production environment, replace the environment constant in the execute method. For example:
112
108
```php
113
109
// For PRODUCTION use
@@ -129,33 +125,32 @@ Additionally, you can find details and examples of how our API is structured in
129
125
The API Reference Guide provides examples of what information is needed for a particular request and how that information would be formatted. Using those examples, you can easily determine what methods would be necessary to include that information in a request using this SDK.
130
126
131
127
128
+
## Building & Testing the SDK
129
+
Integration tests for the AuthorizeNet SDK are in the `tests` directory. These tests
130
+
are mainly for SDK development. However, you can also browse through them to find
131
+
more usage examples for the various APIs.
132
132
133
+
- Run `composer update --dev` to load the `PHPUnit` test library.
134
+
- Copy the `phpunit.xml.dist` file to `phpunit.xml` and enter your merchant
135
+
credentials in the constant fields.
136
+
- Run `vendor/bin/phpunit` to run the test suite.
133
137
138
+
*You'll probably want to disable emails on your sandbox account.*
134
139
135
-
136
-
137
-
140
+
### Testing Guide
141
+
For additional help in testing your own code, Authorize.Net maintains a [comprehensive testing guide](http://developer.authorize.net/hello_world/testing_guide/) that includes test credit card numbers to use and special triggers to generate certain responses from the sandbox environment.
138
142
139
143
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
144
## Logging
148
145
The SDK generates a log with masking for sensitive data like credit card, expiration dates. The provided levels for logging are
149
146
`debug`, `info`, `warn`, `error`. Add ````use \net\authorize\util\LogFactory;````. Logger can be initialized using `$logger = LogFactory::getLog(get_class($this));`
150
147
The default log file `phplog` gets generated in the current folder. The subsequent logs are appended to the same file, unless the execution folder is changed, and a new log file is generated.
151
148
152
-
153
149
### Usage Examples
154
150
- Logging a string message `$logger->debug("Sending 'XML' Request type");`
155
151
- Logging xml strings `$logger->debug($xmlRequest);`
A local copy of [AuthorizedNetSensitiveTagsConfig.json](/lib/net/authorize/util/ANetSensitiveFields.php) gets generated when code invoking the logger first gets executed. The local file can later be edited by developer to re-configure what is masked and what is visible. (*Do not edit the JSON in the SDK*).
161
156
- For each element of the `sensitiveTags` array,
@@ -170,51 +165,5 @@ A local copy of [AuthorizedNetSensitiveTagsConfig.json](/lib/net/authorize/util/
170
165
**For any regex, no starting or ending '/' or any other delimiter should be defined. The '/' delimiter and unicode flag is added in the code.**
171
166
172
167
173
-
## Testing
174
-
Integration tests for the AuthorizeNet SDK are in the `tests` directory. These tests
175
-
are mainly for SDK development. However, you can also browse through them to find
176
-
more usage examples for the various APIs.
177
-
178
-
- Run `composer update --dev` to load the `PHPUnit` test library.
179
-
- Copy the `phpunit.xml.dist` file to `phpunit.xml` and enter your merchant
180
-
credentials in the constant fields.
181
-
- Run `vendor/bin/phpunit` to run the test suite.
182
-
183
-
*You'll probably want to disable emails on your sandbox account.*
184
-
185
-
186
-
### Test Credit Card Numbers
187
-
188
-
| Card Type | Card Number |
189
-
|----------------------------|------------------|
190
-
| American Express Test Card | 370000000000002 |
191
-
| Discover Test Card | 6011000000000012 |
192
-
| Visa Test Card | 4007000000027 |
193
-
| Second Visa Test Card | 4012888818888 |
194
-
| JCB | 3088000000000017 |
195
-
| Diners Club/ Carte Blanche | 38000000000006 |
196
-
197
-
*Set the expiration date to anytime in the future.*
198
-
199
-
200
-
## PHPDoc
201
-
202
-
Add PhpDocumentor to your composer.json and run `composer update --dev`:
203
-
```json
204
-
"require-dev": {
205
-
"phpdocumentor/phpdocumentor": "*"
206
-
}
207
-
```
208
-
To autogenerate PHPDocs run the following at the command line (from the same directory as your composer.json):
0 commit comments