Custom Fields on Transactions

You’ll need to configure your custom fields in the control panel. Once you do, you can use them in the API.

Whatever you configure as the API name for your custom fields will be used when setting them on the transaction. Here is an example of setting custom fields with API names of custom_field_one and custom_field_two.

result = Braintree::Transaction.sale(
  :amount => "10.00",
  :credit_card => {
    :number => "5105105105105100",
    :expiration_date => "05/2012"
  },
  :custom_fields => {
    :custom_field_one => "value one",
    :custom_field_two => "value two"
  }
)

if result.success?
  result.transaction.custom_fields
  #=> {:custom_field_one => "value one", :custom_field_two => "value two"}
end

Validations

See Also