Update payment details using Authorize.net
Posted
by Aditya
on Stack Overflow
See other posts from Stack Overflow
or by Aditya
Published on 2010-04-20T09:50:26Z
Indexed on
2010/04/20
9:53 UTC
Read the original article
Hit count: 338
Hello everybody,
When i update the existing subscription info using update_recurring method of autorize.net gateway then payment details(means 'credit card number', 'CVV number' and 'expiry date' ) are not being updated.
My code snippet is as follows:- def create_card_subscription credit_card = ActiveMerchant::Billing::CreditCard.new( :first_name => params[:payment_details][:name], :last_name => params[:payment_details][:last_name], :number => params[:payment_details][:credit_card_number], :month => params[:expiry_date_month], :year => params[:expiry_date_year], :verification_value => params[:payment_details][:cvv_code] ) if credit_card.valid? gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(:login => '***', :password => '******') response = gateway.update_recurring( { "subscription.payment.credit_card.card_number" => "4111111111111111", :duration =>{:start_date=>'2010-04-21', :occurrences=>1}, :billing_address=>{:first_name=>'xyz', :last_name=>'xyz'}, :subscription_id=>"**" } ) if response.success? puts response.params.inspect puts "Successfully charged $#{sprintf("%.2f", amount / 100)} to the credit card #{credit_card.display_number}. The Account number is #{response.params['rbAccountId']}" else puts response.message end else #Credit Card information is invalid end render :action=>"card_payment" end
How can it be possible?
Thanks in advance, Gaurav Kumar
© Stack Overflow or respective owner