Credit Card Fields
Note
The integration method outlined below is deprecated.
Learn more about upgrading to the Braintree SDKs.
HTML fields
- 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]
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]
credit_card[billing_address_id]
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, if you want to ensure a specific billing country
is submitted, include it in the tr_data
.
- Node
var trData = gateway.transparentRedirect.createCreditCardData({
redirectUrl: "http://www.example.com/urlToRedirectTo",
creditCard: {
billingAddress: {
countryCodeAlpha2: "US"
}
}
});
tr_data
ensures that the parameters can't be tampered with.
- HTML
<!-- DO NOT DO THIS -->
<input type="hidden" name="credit_card[billing_address][country_code_alpha2]" value="CA" />
Mandatory protected fields
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 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:
credit_card[customer_id]
becomes credit_card__customer_id
credit_card[options][verify_card]
becomes
credit_card__options__verify_card