I'm attempting to test out the CIM XML method of working with
authorize.net, and I'm not entirely sure how to even display the
response I'm getting. I've tried a few tricks I know, but everything
is breaking. I know at this point it's gotta' be a simple thing, but
my unfamiliarity with python (still trying to get up to speed) is
rearing its ugly head. How would I display that authResponse object
just to see what kind of errors/values I'm getting? I've tried
authResponse.read and using TAG, but it's coming back in some format I
don't know how to deal with.
Of, even better, if anybody has used CIM XML, can they point me in
another direction that works? =)
Thanks, guys.
//////////////// code ////////////
import urllib2
payload = '''<?xml version="1.0" encoding="utf-8"?>
<createCustomerProfileRequest xmlns=
"AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>xxxxxxxx</name>
<transactionKey>xxxxxxxx</transactionKey>
</merchantAuthentication>
</createCustomerProfileRequest>'''
url = 'https://apitest.authorize.net/xml/v1/request.api'
opener = urllib2.build_opener()
opener.addheaders = [('Content-Type', 'text/xml'),]
req = urllib2.Request(url=url, data=payload)
assert req.get_method() == 'POST'
authResponse = opener.open(req)