Skip to content

Commit 31a7ce3

Browse files
committed
Update README.md
Trimmed usage example section to only keep the links to the dev center sample codes.
1 parent d0cd1c8 commit 31a7ce3

1 file changed

Lines changed: 1 addition & 58 deletions

File tree

README.md

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -63,64 +63,7 @@ Apart from this README, you can find details and examples of using the SDK in th
6363
- [Developer Center Reference](http://developer.authorize.net/api/reference/index.html)
6464
- [Github Sample Code Repositories](http://developer.authorize.net/api/samplecode/), [php](https://github.com/AuthorizeNet/sample-code-php)
6565

66-
### Quick Usage Example (with Charge Credit Card - Authorize and Capture)
67-
- Save the below code to a php file named, say, `charge-credit-card.php`
68-
- Open command prompt and navigate to your sdk folder
69-
- Update dependecies - e.g., With composer, type `composer update`
70-
- Type `php [<path to folder containing the php file>\]charge-credit-card.php`
71-
72-
```php
73-
require 'vendor/autoload.php';
74-
/* provide full path to the sdk in the above code, if you want to run it from some place other than the sdk folder
75-
e.g. if sdk is in c:\anet-sdk-php,
76-
require 'c:/anet-sdk-php/vendor/autoload.php'; */
77-
use net\authorize\api\contract\v1 as AnetAPI;
78-
use net\authorize\api\controller as AnetController;
79-
define("AUTHORIZENET_LOG_FILE", "phplog");
80-
81-
// Common setup for API credentials
82-
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
83-
$merchantAuthentication->setName("556KThWQ6vf2");
84-
$merchantAuthentication->setTransactionKey("9ac2932kQ7kN2Wzq");
85-
86-
// Create the payment data for a credit card
87-
$creditCard = new AnetAPI\CreditCardType();
88-
$creditCard->setCardNumber( "4111111111111111" );
89-
$creditCard->setExpirationDate( "2038-12");
90-
$paymentOne = new AnetAPI\PaymentType();
91-
$paymentOne->setCreditCard($creditCard);
92-
93-
// Create a transaction
94-
$transactionRequestType = new AnetAPI\TransactionRequestType();
95-
$transactionRequestType->setTransactionType( "authCaptureTransaction");
96-
$transactionRequestType->setAmount(151.51);
97-
$transactionRequestType->setPayment($paymentOne);
98-
99-
$request = new AnetAPI\CreateTransactionRequest();
100-
$request->setMerchantAuthentication($merchantAuthentication);
101-
$request->setTransactionRequest( $transactionRequestType);
102-
$controller = new AnetController\CreateTransactionController($request);
103-
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
104-
105-
if ($response != null)
106-
{
107-
$tresponse = $response->getTransactionResponse();
108-
109-
if (($tresponse != null) && ($tresponse->getResponseCode()=="1") )
110-
{
111-
echo "Charge Credit Card AUTH CODE : " . $tresponse->getAuthCode() . "\n";
112-
echo "Charge Credit Card TRANS ID : " . $tresponse->getTransId() . "\n";
113-
}
114-
else
115-
{
116-
echo "Charge Credit Card ERROR : Invalid response\n";
117-
}
118-
}
119-
else
120-
{
121-
echo "Charge Credit card Null response returned";
122-
}
123-
```
66+
While using these samples, load the appropriate dependencies of the sdk (e.g. 'composer update') and modify paths as needed (e.g. in 'require' statement) for the code to work in your system.
12467

12568
## Testing
12669

0 commit comments

Comments
 (0)