Customer Transparent Redirect HTML Fields
These are the HTML fields that can be used when creating or updating customers using Transparent Redirect.
HTML Fields
<!-- Example -->
<input type="text" name="customer[first_name]" />
<!-- id can be whatever you want, only name matters for Braintree -->
<input type="text" name="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] and customer[credit_card][expiration_year].
- 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. You only need to pass one of the four ways of specifying a country.
Protected Fields
Any parameters that you want to submit without letting your users select the value should be included in the tr_data. For example, you want to ensure a specific billing country is submitted, include it in the tr_data.
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 cannot be tampered with.
<!-- DO NOT DO THIS -->
<input type="hidden" name="customer[credit_card][billing_address][country_code_alpha2]" value="CA" />
Mandatory Protected Fields
These fields must be included in tr_data and cannot 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]
Custom Fields
Custom fields need to be configured in the control panel. Once they are, they can be submitted by creating form fields named customer[custom_fields][name_that_was_configured_in_control_panel]
Underscore field name variation
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] becomes customer__first_name
customer[credit_card][cvv] becomes customer__credit_card__cvv