Transaction Transparent Redirect HTML Fields

These are the HTML fields that can be used when creating transactions using Transparent Redirect.

HTML fields

<!-- 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" />
HTML
  • transaction[customer][first_name]
  • transaction[customer][last_name]
  • transaction[customer][company]
  • transaction[customer][email]
  • transaction[customer][phone]
  • transaction[customer][fax]
  • transaction[customer][website]
  • transaction[credit_card][cardholder_name]
  • transaction[credit_card][number]
  • transaction[credit_card][cvv]
  • transaction[credit_card][expiration_date]
  • transaction[credit_card][expiration_month]
  • transaction[credit_card][expiration_year]

For expiration date, you can either use a single field,transaction[credit_card][expiration_date] or separate fields,transaction[credit_card][expiration_month] andtransaction[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.

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

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

Protected fields

Any parameters that you want to submit without letting your users select the value should be included in thetr_data. For example, if you’re building a donation site and asking users to enter the amount they would like to donate, you would want to make amount an HTML field.

<input type="text" name="transaction[amount]" />
HTML

Otherwise, to ensure a specific amount, add it to thetr_data.

tr_data = Braintree::TransparentRedirect.transaction_data(
  :redirect_url => "http://example.com",
  :transaction => {
    :type => "sale",
    :amount => "10.00"
  }
)
Ruby

Do not create amount as a hidden field. Doing so would allow users to tamper with the value. Usingtr_data ensures that the parameters cannot be tampered with.

<!-- DO NOT DO THIS -->
<input type="hidden" name="transaction[amount]" value="10.00" />
HTML

A few other fields may be included either way. For example, if you want to specify whether a transaction should be stored in the vault or not, pass thestore_in_vault option intr_data. If you have a process where you want to ask the user whether they would like their credit card kept on file for easy checkout on future purchases, then you can exposestore_in_vault as a checkbox input.

<input type="checkbox" name="transaction[options][store_in_vault]" value="true" />
HTML

Specifying merchant account:

  • transaction[merchant_account_id]

Related to storing in vault:

  • transaction[options][add_billing_address_to_payment_method]
  • transaction[options][store_shipping_address_in_vault]
  • transaction[options][store_in_vault_on_success]

Mandatory protected fields

These fields must be included intr_data and cannot be passed as a regular input field.

  • transaction[type]
  • transaction[order_id]
  • transaction[customer][id]
  • transaction[credit_card][token]
  • transaction[options][submit_for_settlement]
  • transaction[customer_id]
  • transaction[payment_method_token]

If you’re creating a new customer and storing it in the vault, and you want to specify the customer id, usetransaction[customer][id]. If you’re creating a transaction using a customer that’s already in the vault, specify the id of the customer to charge usingtransaction[customer_id]. Similarly with credit cards,transaction[credit_card][token] is for specifying the token of a new credit card.transaction[payment_method_token] is for referencing an existing payment method in the vault to charge it.

Custom fields

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 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:

transaction[customer_id] becomestransaction__customer_id transaction[options][store_in_vault] becomestransaction__options__store_in_vault

See Also


Still Have Questions?

If you can’t find an answer, give us a call at 877.434.2894 or email our Support team.