Python Authorizenet Test Payment not working on web browsers

I want to perform a test transaction using Python CGI.
In the command prompt output, transaction was successfully charged.
Output as Transaction ID: XXXXXXXX.
But when browsing, the server responded an Internal Server Error - 500. This has to work. I’m using Apache 2.4.20 and Python 2.7 on Windows 10 32-bit. It only works in command prompt and not on the browser.



from authorizenet import apicontractsv1
from authorizenet.apicontrollers import*
from decimal import*
merchantAuth = apicontractsv1.merchantAuthenticationType() ='xxxxxxx'
merchantAuth.transactionKey ='xxxxxxx'
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)
response = createtransactioncontroller.getresponse()
if (response.messages.resultCode=="Ok"):
	   print"Transaction ID : %s"% response.transactionResponse.transId
	   print"response code: %s"% response.messages.resultCode


2016-06-01 08:50:47,532 performing custom validation..
2016-06-01 08:50:47,533 Executing http post to url:
2016-06-01 08:50:47,533 building request..
2016-06-01 08:50:47,565 Starting new HTTPS connection (1):
2016-06-01 08:50:50,369 "POST /xml/v1/request.api HTTP/1.1" 200 922
2016-06-01 08:50:50,403 Create Document Exception: <class 'pyxb.exceptions_.UnrecognizedContentError'>, (<authorizenet.apicontractsv1.transactionResponse object at 0x0269B670>, <pyxb.binding.content.AutomatonConfiguration object at 0x0269B6F0>, u'Visa', pyxb.utils.utility.Location(None, 1, 722))

Is it a server error or a code bug? Could anyone help me fix this issue. Thanks in advance.

I’m getting the same problem. Were you able to figure out a fix?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.