Transparent Redirect

Credit Card Fieldsanchor

note

The integration method outlined below is deprecated. Learn more about upgrading to the Braintree SDKs.

These are the HTML fields that can be used when creating or updating credit cards using Transparent Redirect.

HTML fieldsanchor

  1. HTML
<!-- Example -->
    <input type="text" name="credit_card[number]" />

    <!-- id can be whatever you want, only name matters for Braintree -->
    <input type="text" name="credit_card[number]" id="whateverYouWant" />
  • credit_card[cardholder_name]
  • credit_card[number]
  • credit_card[cvv]
  • credit_card[expiration_date]
  • credit_card[expiration_month]
  • credit_card[expiration_year]
  • credit_card[options][make_default]

For expiration date, you can either use a single field, credit_card[expiration_date] or separate fields, credit_card[expiration_month] and credit_card[expiration_year].

  • credit_card[billing_address][first_name]
  • credit_card[billing_address][last_name]
  • credit_card[billing_address][company]
  • credit_card[billing_address][street_address]
  • credit_card[billing_address][extended_address]
  • credit_card[billing_address][locality]
  • credit_card[billing_address][region]
  • credit_card[billing_address][postal_code]
  • credit_card[billing_address][country_code_alpha2]
  • credit_card[billing_address][country_code_alpha3]
  • credit_card[billing_address][country_code_numeric]
  • credit_card[billing_address][country_name]

We only accept a specific list of countries so you will want to make country a select field. You only need to pass one of the four ways of specifying a country.

Instead of creating a new address for the credit card, you can specify that a customer’s existing address is attached to the credit card as the billing address by passing in its ID:

  • credit_card[billing_address_id]

Protected fieldsanchor

Any parameters that you want to submit without letting your users select the value should be included in the tr_data. For example, if you want to ensure a specific billing country is submitted, include it in the tr_data.

  1. Ruby
tr_data = Braintree::TransparentRedirect.create_credit_card_data(
    :redirect_url => "http://example.com",
    :credit_card => {
        :billing_address => {
        :country_code_alpha2 => "US"
        }
    }
    )

Do not create hidden fields for TR params. Doing so would allow users to tamper with the value. Usingtr_data ensures that the parameters can't be tampered with.

  1. HTML
<!-- DO NOT DO THIS -->
    <input type="hidden" name="credit_card[billing_address][country_code_alpha2]" value="CA" />

Mandatory protected fieldsanchor

These fields must be included in tr_data and can't be passed as a regular input field.

  • credit_card[token]
  • credit_card[customer_id]
  • credit_card[billing_address][options][update_existing]
  • credit_card[options][verify_card]
  • credit_card[options][verification_merchant_account_id]
  • credit_card[options][fail_on_duplicate_payment_method]

Underscore field name variationanchor

Some frameworks have trouble parsing square brackets in HTML field names. For this reason, the gateway supports an alternate field name notation using double underscores instead of square brackets to delimit keys in the field name. So, for example:

credit_card[customer_id] becomes credit_card__customer_id credit_card[options][verify_card] becomes credit_card__options__verify_card

See alsoanchor