AuthorizeNet / sample-code-ruby

This repository contains working code samples which demonstrate ruby integration with the Authorize.Net API
MIT License
24 stars 58 forks source link

Not able to create customer profile #52

Closed artanzels1212 closed 5 years ago

artanzels1212 commented 6 years ago

Using authorizenet gem 1.8.9 ruby 1.9.3

on trying to create a customer profile I am getting this error

require 'authorizenet'

transaction = AuthorizeNet::API::Transaction.new(some_id, some_key, :gateway => :sandbox)

request = AuthorizeNet::API::CreateCustomerProfileRequest.new(nil,nil,nil, 'liveMode')

request.profile = AuthorizeNet::API::CustomerProfileType.new("sumeetyesme1870", "sumeet new","sumeet@example.com")

actual request

 request
=> #<AuthorizeNet::API::CreateCustomerProfileRequest:0x0000000652d4c8
 @merchantAuthentication=nil,
 @profile=
  #<AuthorizeNet::API::CustomerProfileType:0x000000067c6c98
   @description="sumeet new",
   @email="sumeet@masih.com",
   @merchantCustomerId="sumeetMasih1870",
   @paymentProfiles=[],
   @shipToList=[]>,
 @refId=nil,
 @validationMode="liveMode">

response = transaction.create_customer_profile(request)

on printing response

puts response.messages.messages[0].code 

I get E00003

puts response.messages.messages[0].text

The element 'paymentProfiles' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' cannot contain text. List of possible elements expected: 'customerType, billTo, payment, driversLicense, taxId, defaultPaymentProfile' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.

gnongsie commented 5 years ago

Hi @artanzels1212 ,

Thanks for reaching out to us on this issue.

As per the documentation for Create Customer Profile API, if the customer profile does not contain any payment data, the validation mode field should not be sent.

Can you try this again without the validation mode? Or you can try it by supplying some payment data?

gnongsie commented 5 years ago

Based on the above comment, I am closing this issue. Kindly reopen it if the issue is not fixed.

Thanks