cancel
Showing results for 
Search instead for 
Did you mean: 

Collect card info once; charge, create customer profile, payment profile, and subscription via .NET

I'm trying to integrate customer payments via the Authorize.Net .NET SDK. My data flow process is as follows:

 

When customer converts from free trial to paid subscription mode, I want to:

A. Collect payment information (credit card numbers, addresses, billing names, etc).

B. Via Accept.JS, convert the payment information to a nonce.

C. Use the nonce to charge the customer the first month's subscription rate.

D. Use the success of the charge to determine if I proceed. If successful,

E. Use the transaction ID to create a CIM customer profile, a customer payment profile, and an ARB.

 

I pass a billTo object of type customerAddressType to the transactionRequestType request object. If I define a first name, last name, or company name on this address, then the call to controller.Executes shows an error that "E00003:The element 'billTo' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'firstName' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.

 

Removing the firstName value from my customerAddressType subsequently yields similar errors regarding "lastName" and "company".

 

If I remove firstName, lastName, and company from my address object, then I'm allowed to successfully create a charge to this card.

 

However, when I follow it up with a request to CreateCustomerProfileFromTransaction, the created payment profile has no name information associated with it. A quick check in the CIM confirms this.

 

This presents a problem when I attempt to create the subscription, as the payment profile cannot be used as the billTo address is missing firstName.

 

 

Is is possible to create a reusable payment profile from a transaction generated by a nonce/opaqueDataType?

 

I understand the order of the XML may play a part here, but as I'm using the SDK I have no control over the created XML. Is it even viewable in a log somewhere?

jkshay
Member
2 REPLIES 2

Hi @jkshay

 

One you have the accept nonce and done the payment . 

 

You can still use the accept nonce to create the customer profile by passing it in the 

Create Customer Profile  call 

 

https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-profile

 

 

opaqueData Required.
Contains dataDescriptor and dataValue.

 
dataDescriptor Required.
Specifies how the request should be processed.

The value of dataDescriptor is based on the source of the value of dataValue.
String, 128 characters.

Use COMMON.ACCEPT.INAPP.PAYMENTfor Accept transactions.




Send feedback at developer_feedback@authorize.net
Anurag
Moderator Moderator
Moderator

If you change the order of the nodes in the XML, you can generate the same error that I receive in my controller when I call .Execute():

 

<createCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> 
<merchantAuthentication>
<name>XXXXXXXXXX</name>
<transactionKey>XXXXXXXXXXXXXXXX</transactionKey>
</merchantAuthentication>
<profile>
<description>Profile description here</description>
<merchantCustomerId>Merchant_Customer_ID</merchantCustomerId>
<email>customer-profile-email@here.com</email>
</profile>
<validationMode>none</validationMode>
</createCustomerProfileRequest>

will generate this error:

 

E00003 : The element 'profile' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'merchantCustomerId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'email, paymentProfiles, shipToList' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.

Be aware that I'm using the .NET SDK and therefore have no control over the order of the XML generated by the SDK.