Skip to content

Commit f1616f6

Browse files
authored
Merge pull request AuthorizeNet#81 from adavidw/readme
Standardize readme format and info across repos
2 parents 379edea + c674d0a commit f1616f6

File tree

2 files changed

+44
-60
lines changed

2 files changed

+44
-60
lines changed

License.md renamed to LICENSE.txt

File renamed without changes.

README.md

Lines changed: 44 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -5,101 +5,85 @@
55
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/AuthorizeNet/sdk-python/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/AuthorizeNet/sdk-python/?branch=master)
66
[![PyPI](https://img.shields.io/pypi/v/authorizenet.svg)](https://badge.fury.io/py/authorizenet)
77

8-
`pip install authorizenet`
98

9+
## Requirements
10+
* Python 2.7 or greater
11+
* OpenSSL 1.0.2 or greater
12+
* An Authorize.Net account (see _Registration & Configuration_ section below)
1013

11-
## Prerequisites
14+
_Note: Our goal is ensuring this SDK is compatible with Python 2.7+, 3.2+ and PyPy, but at the moment we're primarily testing against Python 2.7._
1215

13-
We'll be ensuring this SDK is compatible with Python 2.6+, 3.2+ and PyPy but we're primarily testing against Python 2.7 so that's the current prerequisite.
16+
### TLS 1.2
17+
The Authorize.Net APIs only support connections using the TLS 1.2 security protocol. It's important to make sure you have new enough versions of all required components to support TLS 1.2. Additionally, it's very important to keep these components up to date going forward to mitigate the risk of any security flaws that may be discovered in your system or any libraries it uses.
1418

1519

1620
## Installation
17-
To install AuthorizeNet
21+
To install the AuthorizeNet Python SDK:
1822

1923
`pip install authorizenet`
2024

2125

2226
## Registration & Configuration
27+
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.
28+
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/).
29+
30+
### Authentication
31+
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).
2332

24-
Get a sandbox account at https://developer.authorize.net/sandbox
25-
Set your API credentials:
33+
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.
2634

27-
````python
35+
#### To set your API credentials for an API request:
36+
```python
2837
merchantAuth = apicontractsv1.merchantAuthenticationType()
2938
merchantAuth.name = 'YOUR_API_LOGIN_ID'
3039
merchantAuth.transactionKey = 'YOUR_TRANSACTION_KEY'
31-
````
32-
33-
34-
## Usage
35-
See our sample code repository at https://github.com/AuthorizeNet/sample-code-python
36-
37-
For the simplest "Hello World" example, paste this into a file called charge-credit-card.py and run:
38-
39-
````python
40-
from authorizenet import apicontractsv1
41-
from authorizenet.apicontrollers import *
42-
from decimal import *
40+
```
4341

44-
merchantAuth = apicontractsv1.merchantAuthenticationType()
45-
merchantAuth.name = 'YOUR_LOGIN_ID'
46-
merchantAuth.transactionKey = 'YOUR_TRANSACTION_KEY'
42+
You should never include your Login ID and Transaction Key directly in a 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.
4743

48-
creditCard = apicontractsv1.creditCardType()
49-
creditCard.cardNumber = "4111111111111111"
50-
creditCard.expirationDate = "2020-12"
44+
### Switching between the sandbox environment and the production environment
45+
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, use the `setenvironment` method on the controller before executing. For example:
46+
```python
47+
# For PRODUCTION use
48+
createtransactioncontroller.setenvironment(constants.PRODUCTION)
49+
```
5150

52-
payment = apicontractsv1.paymentType()
53-
payment.creditCard = creditCard
51+
API credentials are different for each environment, so be sure to switch to the appropriate credentials when switching environments.
5452

55-
transactionrequest = apicontractsv1.transactionRequestType()
56-
transactionrequest.transactionType = "authCaptureTransaction"
57-
transactionrequest.amount = Decimal ('1.55')
58-
transactionrequest.payment = payment
5953

54+
## SDK Usage Examples and Sample Code
55+
To get started using this SDK, it's highly recommended to download our sample code repository:
56+
* [Authorize.Net Python Sample Code Repository (on GitHub)](https://github.com/AuthorizeNet/sample-code-python)
6057

61-
createtransactionrequest = apicontractsv1.createTransactionRequest()
62-
createtransactionrequest.merchantAuthentication = merchantAuth
63-
createtransactionrequest.refId = "MerchantID-0001"
58+
In that respository, we have comprehensive sample code for all common uses of our API:
6459

65-
createtransactionrequest.transactionRequest = transactionrequest
66-
createtransactioncontroller = createTransactionController(createtransactionrequest)
67-
createtransactioncontroller.execute()
60+
Additionally, you can find details and examples of how our API is structured in our API Reference Guide:
61+
* [Developer Center API Reference](http://developer.authorize.net/api/reference/index.html)
6862

69-
response = createtransactioncontroller.getresponse()
63+
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.
7064

71-
if (response.messages.resultCode=="Ok"):
72-
print "Transaction ID : %s" % response.transactionResponse.transId
73-
else:
74-
print "response code: %s" % response.messages.resultCode
7565

76-
````
77-
### Setting Production or Sandbox Environments
78-
To set the environment use the setenvironment method on the controller before executing. E.g. for the example above:
79-
````python
80-
# Defaults to constants.SANDBOX for sandbox testing
81-
createtransactioncontroller.setenvironment(constants.PRODUCTION)
82-
````
66+
## Building & Testing the SDK
8367

84-
## Building and Testing Source Code
85-
86-
Requirements
87-
--------------------------------------
68+
### Requirements
8869
- python 2.7
8970
- pyxb 1.2.4
9071

91-
9272
Run the following to get pyxb and nosetests:
9373
- pip install pyxb
9474
- pip install unittest2
9575
- pip install nose
9676
- pip install lxml
9777

98-
Testing
99-
--------------------------------------
78+
### Running the SDK Tests
10079
- Tests available are: unit tests, mock tests, sample code
101-
- use nosetests to run all unittests
102-
`
103-
>nosetests
104-
`
80+
- use nosetests to run all unittests
81+
82+
`>nosetests`
83+
84+
### Testing Guide
85+
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.
86+
10587

88+
## License
89+
This repository is distributed under a proprietary license. See the provided [`LICENSE.txt`](/license.txt) file.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy