Braintree rejects Discover cards on consecutive transactions

156 views Asked by At

Background

We are executing the below method in order to charge a user and store his/her information in Braintree vault:

def store_in_vault
  Braintree::Transaction.sale(:amount => amount,
  :credit_card => {
    :cardholder_name => cardholder_name,
    :number => credit_card_number,
    :expiration_date => "#{credit_card_expiration_month}/#{credit_card_expiration_year}",
    :cvv => credit_card_cvv
  },
  :customer => {
    :id => user.id,
    :first_name => user.first_name,
    :last_name => user.last_name,
    :email => user.email,
    :phone => user.phone_main
  },
  :billing => {
    :first_name => user.first_name,
    :last_name => user.last_name,
    :street_address => street_address,
    :extended_address => extended_address,
    :locality => city,
    :region => state,
    :postal_code => zip,
    :country_code_numeric => country
  },
  :options => {
    :submit_for_settlement => false,
    :store_in_vault_on_success => true
  })
end

Later, we also put a hold on user's credit card as a security deposit.

All works well for most of the credit cards. However, when we try to put such security hold on Discover cards our transaction gets rejected with "Processor Declined" or "Declined" error. Note, that the initial transaction above to store user account in vault and charging credit card executes successfully. Just the later security hold transaction gets rejected.

Questions

Why this behavior happens only to Discover cards? How to fix it?

1

There are 1 answers

0
AudioBubble On BEST ANSWER

It is somehow related to Discover cards verification process. They require CVV and zip code to be included in transaction.

As per Braintree support :options in the above request have to include :add_billing_address_to_payment_method => true as follwoing:

:options => {
  :submit_for_settlement => false,
  :store_in_vault_on_success => true,
  :add_billing_address_to_payment_method => true
}

In addition, during credit card replacement request (if required), one should add :billing_address information:

Braintree::CreditCard.create(
  :customer_id => "#{user_id}",
  :number => cc_number,
  :expiration_date => "#{expiration_month}/#{expiration_year}",
  :cardholder_name => cardholder_name,
  :cvv => cvv,
  :billing_address => {
    :street_address => street_address,
    :extended_address => extended_address,
    :locality => city,
    :region => state,
    :postal_code => zip
  },
  :options => {
    :make_default => true
  }
)