【问题标题】:Update payment details using Authorize.net使用 Authorize.net 更新付款详情
【发布时间】:2011-02-10 01:41:23
【问题描述】:

当我使用 autorize.net 网关的 update_recurring 方法更新现有订阅信息时,付款详细信息(信用卡号、CVV 号和到期日)不会更新。

我的代码sn-p如下:-

  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

【问题讨论】:

    标签: authorize.net recurring-billing


    【解决方案1】:

    试试这样的:

    credit_card = ActiveMerchant::Billing::CreditCard.new({
      :number => self.ccnum,
      :verification_value => self.ccv,
      :month => self.exp_month,
      :year => self.exp_year,
      :first_name => self.first_name,
      :last_name => self.last_name
    })
    
    response = gateway.update_recurring({
        :subscription_id => self.subscription_id,
        :amount => 10000000,
        :credit_card => credit_card,
        :customer => {
          :email => "fjdksl@jklfdsjflkd.com"
        },            
        :billing_address => {
          :first_name => self.first_name,
          :last_name => self.last_name,
          :address1 => self.address + " " + self.address2,
          :city => self.city,
          :state => self.state,
          :country => "US",
          :zip => self.zip
        }
      })
    

    【讨论】:

      猜你喜欢
      • 2012-01-04
      • 2014-01-03
      • 2014-01-06
      • 2013-12-27
      • 2012-07-07
      • 2011-03-22
      • 2012-07-12
      • 2021-07-24
      • 2023-03-10
      相关资源
      最近更新 更多