So I just created a sandbox account and got my API ID and KEY
I went to the following link and followed it's instrucitons: https://developer.authorize.net/hello_world/
So I installed the python SDK module with:
pip install authorizenet
Then ran the code given verbatim, changing my API ID and KEY of course
from authorizenet import apicontractsv1 from authorizenet.apicontrollers import* from decimal import* merchantAuth = apicontractsv1.merchantAuthenticationType() merchantAuth.name ='REPLACED WITH MY ID' merchantAuth.transactionKey ='REPLACED WITH MY KEY' creditCard = apicontractsv1.creditCardType() creditCard.cardNumber ="4111111111111111" creditCard.expirationDate ="2020-12" payment = apicontractsv1.paymentType() payment.creditCard = creditCard transactionrequest = apicontractsv1.transactionRequestType() transactionrequest.transactionType ="authCaptureTransaction" transactionrequest.amount = Decimal ('1.55') transactionrequest.payment = payment createtransactionrequest = apicontractsv1.createTransactionRequest() createtransactionrequest.merchantAuthentication = merchantAuth createtransactionrequest.refId ="MerchantID-0001" createtransactionrequest.transactionRequest = transactionrequest createtransactioncontroller = createTransactionController(createtransactionrequest) createtransactioncontroller.execute() response = createtransactioncontroller.getresponse() if (response.messages.resultCode=="Ok"): print"Transaction ID : %s"% response.transactionResponse.transId else: print"response code: %s"% response.messages.resultCode
But the error I get is:
if (response.messages.resultCode=="Ok"): AttributeError: 'NoneType' object has no attribute 'messages'
This happens no matter what I try to query. Like if I try to get a list of all unsettled transactions, the Library returns Null.
Thanks!
Solved! Go to Solution.
08-09-2017 05:33 PM