cancel
Showing results for 
Search instead for 
Did you mean: 

CIM update payment profile always returns nil

So I'm trying to add "update a payment profile" functionality and it always returns a nil response. I'm using the ruby sdk, http://rubydoc.info/gems/authorize-net/1.5.2/frames , CIM > Transaction > update_payment_profile function with no luck.. I can create and delete payment profiles, just not update. 

 

I'm retrieving the payment profile object with get_payment_profile, and for now just trying to update a card/account number..So the payment profile object I have from my get request looks like this.. (I dotted out the customer_payment_profile_id just to be cautious, but yes it is there)

 

#<AuthorizeNet::CIM::PaymentProfile:0x00000105d0f358 @customer_payment_profile_id="5....8", @payment_method=#<AuthorizeNet::CreditCard:0x00000105ccb3b0 @card_number="XXXX1111", @expiration="XXXX", @card_code=nil, @card_type=nil, @track_1=nil, @track_2=nil>>

 

and the object I'm sending back for update looks like this..

 

#<AuthorizeNet::CIM::PaymentProfile:0x00000105d0f358 @customer_payment_profile_id="5....8", @payment_method=#<AuthorizeNet::CreditCard:0x00000105ccb3b0 @card_number="1111222233336666", @expiration="XXXX", @card_code=nil, @card_type=nil, @track_1=nil, @track_2=nil>>

 

in a nutshell here's how I'm updating the card_number

 

response = transaction.get_payment_profile(payment_profile.payment_profile_id, payment_profile.customer_profile_id)
cim_payment_profile = response.payment_profile 
cim_payment_profile.payment_method.card_number = params[:credit_card_number]
response = transaction.update_payment_profile(cim_payment_profile, cim_payment_profile.customer_payment_profile_id, :validation_mode => :none)

 

I'm using the sandbox gateway, and i've tried liveMode, testMode, and none for validation mode.. and i'm all out of ideas. Anyone got an idea where I'm going wrong?

mbishop541
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Not sure if this is the problem, but they all said

If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

Maybe you need a new transaction object?


View solution in original post

4 REPLIES 4

Just being nosy, but on the methods documentation page

http://rubydoc.info/gems/authorize-net/1.5.2/AuthorizeNet/CIM/Transaction:update_payment_profile

 

It show the second parameter as the profileID and not the paymentProfileID.

RaynorC1emen7
Expert

Ahh.. yes good catch..must have screwed that up while messing with the params.. however I'm still not having any luck with

response = transaction.update_payment_profile(cim_payment_profile, current_user.customer_profile_id, :validation_mode => :none)

 or 

response = transaction.update_payment_profile(cim_payment_profile, payment_profile.customer_profile_id, :validation_mode => :none)

 

still trying...

 

Not sure if this is the problem, but they all said

If this transaction has already been run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.

Maybe you need a new transaction object?


WOOO!  Thanks..that was exactly the problem. I guess it never really dawned on me thats what that meant, I guess I thought it ignored duplicate update requests... Thanks again.