creating customer profile from transaction


I’m currently charging a customer and then trying to create a customer profile based on that charge. The problem is that when I try and actually create the customer it fails, telling me that there is no response and instead prints out `

AttributeError: no such child:

Here is the code, and below this chunk is a bit more explanation and what I’m doing to parse the response.

merchantAuth = apicontractsv1.merchantAuthenticationType() = app_config.AUTHORIZE_KEYS['apiLoginId']
merchantAuth.transactionKey = app_config.AUTHORIZE_KEYS['transactionKey']
# Create the payment object for a payment nonce
opaqueData = apicontractsv1.opaqueDataType()
opaqueData.dataDescriptor = request.form['dataDesc']
opaqueData.dataValue = request.form['dataValue']

# Add the payment data to a paymentType object
paymentOne = apicontractsv1.paymentType()
paymentOne.opaqueData = opaqueData

# Create order information
order = apicontractsv1.orderType()
order.invoiceNumber = "invoice_%s" %
order.description = "Awesome"
# Set the customer's identifying information
customerData = apicontractsv1.customerDataType()
customerData.type = "individual" = "cus_%s" % = email
# Giving the credit card info
# Setting billing information
billto = apicontractsv1.nameAndAddressType()
billto.firstName = request.form['firstName']
billto.lastName = request.form['lastName']
billto.address = address1 = city
billto.state = state = zipcode = country
item = request.form['item']
if item == 'dollar':
    amount = "3.00"
if item == "monthly":
    amount = "5.00"
    length = 1
if item == "annual":
    amount = "50.00"
    length = 12
# Create order information
order = apicontractsv1.orderType()
order.invoiceNumber = "invoice_%s" %
order.description = "Awesomeness"

# # Set the customer's Bill To address
customerAddress = apicontractsv1.customerAddressType()
customerAddress.firstName = request.form['firstName']
customerAddress.lastName = request.form['lastName']
customerAddress.address = address1 = city
customerAddress.state = state = zipcode = country

# Create customer profile on transaction
createcustomerprofile = apicontractsv1.customerProfilePaymentType()
createcustomerprofile.createProfile = True

# Create a transactionRequestType object and add the previous objects to it.
transactionrequest = apicontractsv1.transactionRequestType()
transactionrequest.transactionType = "authCaptureTransaction"
transactionrequest.amount = amount
transactionrequest.payment = paymentOne
transactionrequest.order = order
transactionrequest.billTo = customerAddress
transactionrequest.customer = customerData
transactionrequest.profile = createcustomerprofile

# Assemble the complete transaction request
createtransactionrequest = apicontractsv1.createTransactionRequest()
createtransactionrequest.merchantAuthentication = merchantAuth
createtransactionrequest.refId = refId
createtransactionrequest.transactionRequest = transactionrequest

# Create the controller
createtransactioncontroller = createTransactionController(createtransactionrequest)

The problem seems to occur when I try and prase the response. but when I actually run the code as is suggested in the developers documentation

response = createtransactioncontroller.getresponse()
logging.debug("%s" % response)
if response is not None:
        # Check to see if the API request was successfully received and acted upon
    if response.messages.resultCode == "Ok":
        # Since the API request was successful, look for a transaction response
        # and parse it to display the results of authorizing the card
        if hasattr(response.transactionResponse, 'messages') == True:
            if hasattr(response.profileResponse, 'messages') == True:
                print('made it here')
            models.Payment(user=user, payment_date=datetime.utcnow(),
                                     authorize={'email': email, 'updated': False,
                                                'address': u'%s %s' % (address1, address2),
                                                'messages': {'transId':'%s' % response.transactionResponse.transId,
                                                'responseCode':'%s' % response.transactionResponse.responseCode,
                                                'auth_code':'%s' % response.transactionResponse.messages.message[0].code,
                                                'Description':'%s' % response.transactionResponse.messages.message[0].description,
                                                # 'customerProfileId': '%s' % response.profileResponse.customerProfileId,
                                                # 'customerPaymentProfileIdList': '%s' % response.profileResponse.customerPaymentProfileIdList,

Given their documentation shows that you can create the customer when making the transaction not sure why it’s returning that it’s not working.

Also when I check the schema for the XML response it seems I’m setting it correctly.

Asked By: nadermx



Having the same problem in C# SDK. Diving into this it states an error message: “Customer profile creation failed. This payment method does not support profile creation.” So I’m guessing you can’t make a payment profile from opaque card data! 🙁

Answered By: berr08

One thing I was able to do. Create a Transaction with the Opaque Data. with the transaction create_customer_profile_from_transaction. from there the payment profile is ready too.

Answered By: Efrain Valles
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.