Skip to content

Commit 7958279

Browse files
committed
Update README.md
1 parent 198ba89 commit 7958279

File tree

1 file changed

+43
-6
lines changed

1 file changed

+43
-6
lines changed

README.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
[![Build Status](https://travis-ci.org/AuthorizeNet/sdk-python.png?branch=master)]
44
(https://travis-ci.org/AuthorizeNet/sdk-python)
55

6-
`pip install AuthorizeNet`
6+
`pip install authorizenet`
77

88
*** The Python SDK is still in limited Beta testing, please contact developer@authorize.net for more information ***
99

1010
## Prerequisites
1111

12-
Requires
12+
We'll be ensuring this SDK is compatible with Python 2.6+, 3.2+ and PyPy but for the beta release we're primarily testing against Python 2.7 so that's the current prerequisite.
1313

1414

1515
## Installation
1616
To install AuthorizeNet
1717

18-
`pip install AuthorizeNet`
18+
`pip install authorizenet`
1919

2020

2121
## Registration & Configuration
@@ -33,11 +33,46 @@ For reporting tests, go to https://sandbox.authorize.net/ under Account tab->Tra
3333

3434

3535
## Usage
36-
See our sample code repository at https://github.com/AuthorizeNet/sample-code-python
36+
See our sample code repository at https://github.com/AuthorizeNet/sample-code-python (*** NOTE during beta the sample code repo is a work in progress ***)
3737

38-
For the simplest "Hello World" example, use paste this into a file called charge-credit-card.py and run:
38+
For the simplest "Hello World" example, paste this into a file called charge-credit-card.py and run:
3939

4040
````python
41+
from authorizenet import apicontractsv1
42+
from authorizenet.apicontrollers import *
43+
from decimal import *
44+
45+
merchantAuth = apicontractsv1.merchantAuthenticationType()
46+
merchantAuth.name = '5KP3u95bQpv'
47+
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'
48+
49+
creditCard = apicontractsv1.creditCardType()
50+
creditCard.cardNumber = "4111111111111111"
51+
creditCard.expirationDate = "2020-12"
52+
53+
payment = apicontractsv1.paymentType()
54+
payment.creditCard = creditCard
55+
56+
transactionrequest = apicontractsv1.transactionRequestType()
57+
transactionrequest.transactionType = "authCaptureTransaction"
58+
transactionrequest.amount = Decimal ('1.55')
59+
transactionrequest.payment = payment
60+
61+
62+
createtransactionrequest = apicontractsv1.createTransactionRequest()
63+
createtransactionrequest.merchantAuthentication = merchantAuth
64+
createtransactionrequest.refId = "MerchantID-0001"
65+
66+
createtransactionrequest.transactionRequest = transactionrequest
67+
createtransactioncontroller = createTransactionController(createtransactionrequest)
68+
createtransactioncontroller.execute()
69+
70+
response = createtransactioncontroller.getresponse()
71+
72+
if (response.messages.resultCode=="Ok"):
73+
print "Transaction ID : %s" % response.transactionResponse.transId
74+
else:
75+
print "response code: %s" % response.messages.resultCode
4176

4277
````
4378

@@ -58,5 +93,7 @@ Testing
5893
--------------------------------------
5994
- Tests available are: unit tests, mock tests, sample code
6095
- use nosetests to run all unittests
61-
96+
`
97+
>nosetests
98+
`
6299

0 commit comments

Comments
 (0)