cancel
Showing results for 
Search instead for 
Did you mean: 

DotNet Create a CustomerPaymentProfile

I have the following code.

I'm having trouble with adding a paymentprofile to an existing customerprofile.

Specifically the PaymentType and CreditCardSimpleType. 

If someone could review my code, i'm getting a serialization error in the xml.  I'm pretty sure the error lies in the line near the bottom "myPaymentType.Item = myCreditCardSimpleType"

 

Actual error: "The type LTLM.Cards.wsAuthorize.CreditCardSimpleType was not expected." (generating the xml document)

 

Thank you very much in advance for any assistance.

Chris@3csol.net

 

'web service binding info

Dim binding AsNew ServiceModel.BasicHttpBinding(System.ServiceModel.BasicHttpSecurityMode.Transport)

Dim myURL AsString = ""

myURL = Auth_URL

Dim epa AsNew ServiceModel.EndpointAddress(myURL)

Dim myWS AsNew wsAuthorize.ServiceSoapClient(binding, epa)

 

'Starting to create the profile:

Dim myResponse_CreatePaymentProfile AsNew wsAuthorize.CreateCustomerPaymentProfileResponseType

Dim myMerchantAuthenticationType AsNew wsAuthorize.MerchantAuthenticationType

Dim myValidationModeEnum AsNew wsAuthorize.ValidationModeEnum

myValidationModeEnum = wsAuthorize.ValidationModeEnum.none

myMerchantAuthenticationType.name = Auth_ID

myMerchantAuthenticationType.transactionKey = Auth_Key

Dim myCustomerPaymentProfileType AsNew wsAuthorize.CustomerPaymentProfileType

Dim myCreditCardSimpleType AsNew wsAuthorize.CreditCardSimpleType

myCreditCardSimpleType.cardNumber = tbCardNumber.Text

myCreditCardSimpleType.expirationDate = ddYear.SelectedText & "-" & ddMonth.SelectedText

Dim myCustomerAddressType AsNew wsAuthorize.CustomerAddressType

myCustomerAddressType.firstName = NullStrCheck(tbFirstName.Text, 50)

myCustomerAddressType.lastName = NullStrCheck(tbLastName.Text, 50)

myCustomerAddressType.company = NullStrCheck(tbCompany.Text, 50)

myCustomerAddressType.address = NullStrCheck(tbAdd1.Text, 60)

myCustomerAddressType.city = NullStrCheck(tbCity.Text, 40)

myCustomerAddressType.state = NullStrCheck(ddState.SelectedText, 40)

myCustomerAddressType.zip = NullStrCheck(tbZip.Text, 20)

myCustomerAddressType.phoneNumber = NullNoAlphaCheck(tbPhone.Text, 25)

myCustomerPaymentProfileType.billTo = myCustomerAddressType

If Len(NullStrCheck(tbCompany.Text)) > 0 Then

myCustomerPaymentProfileType.customerTypeSpecified = True

myCustomerPaymentProfileType.customerType = wsAuthorize.CustomerTypeEnum.business

EndIf

 

'I think the error is in this section

Dim myPaymentType AsNew wsAuthorize.PaymentType

myPaymentType.Item = myCreditCardSimpleType

myCustomerPaymentProfileType.payment = myPaymentType

 

'this actually creates the payment Profile:

myResponse_CreatePaymentProfile = myWS.CreateCustomerPaymentProfile(myMerchantAuthenticationType, _CustomerProfileID, myCustomerPaymentProfileType, myValidationModeEnum)

 

chrisworking
Member
2 REPLIES 2

as a side note this is for the CIM functionality

chrisworking
Member

I think you use the creditCardType, and not CreditCardSimpleType

Here the schema

https://api.authorize.net/xml/v1/schema/AnetApiSchema.xsd