Transparent Redirect

Customer 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 customers using Transparent Redirect.

HTML fieldsanchor

  1. HTML
<!-- Example -->
<input type="text" name="transaction[customer][first_name]" />

<!-- id can be whatever you want, only name matters for Braintree -->
<input type="text" name="transaction[customer][first_name]" id="whateverYouWant" />
  • customer[first_name]
  • customer[last_name]
  • customer[company]
  • customer[email]
  • customer[phone]
  • customer[fax]
  • customer[website]
  • customer[credit_card][cardholder_name]
  • customer[credit_card][number]
  • customer[credit_card][cvv]
  • customer[credit_card][expiration_date]
  • customer[credit_card][expiration_month]
  • customer[credit_card][expiration_year]

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

  • transaction[billing][first_name]
  • transaction[billing][last_name]
  • transaction[billing][company]
  • transaction[billing][street_address]
  • transaction[billing][extended_address]
  • transaction[billing][locality]
  • transaction[billing][region]
  • transaction[billing][postal_code]
  • transaction[billing][country_code_alpha2]
  • transaction[billing][country_code_alpha3]
  • transaction[billing][country_code_numeric]
  • transaction[billing][country_name]

For country, you only need to use one of the four fields for specifying country.

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

We only accept a specific list of countries so you will want to make country a select field.

Protected fieldsanchor

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

Generating the TR Data:

  1. Ruby
tr_data = Braintree::TransparentRedirect.create_customer_data(
        :redirect_url => "http://example.com/url_to_redirect_to",
        :customer => {
            :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. Using tr_data ensures that the parameters can't be tampered with.

  1. HTML
<!-- DO NOT DO THIS -->
    <input type="hidden" name="customer[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.

  • customer[id]
  • customer[credit_card][token]
  • customer[credit_card][options][verify_card]
  • customer[credit_card][options][verification_merchant_account_id]
  • customer[credit_card][options][fail_on_duplicate_payment_method]

Custom fieldsanchor

Custom fields need to be configured in the Control Panel. Once they are, they can be submitted by creating form fields namedtransaction[custom_fields][name_that_was_configured_in_control_panel]

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:

customer[first_name] becomescustomer__first_name customer[credit_card][cvv] becomescustomer__credit_card__cvv

See alsoanchor