Braintree Gateway Guide

close

Services and Compatibility

Payment Gateway Company Name:
Braintree
Services that work with Spreedly:
  • Braintree
Supported operations:
Purchase, Authorize, Capture, Refund, Void, Verify, Store
Supported payment types:
Credit Card, Apple Pay, Android Pay
Regions:
Asia Pacific, Europe, North America

Authentication and Security

Specific names for credentials:
orange mode:
Login, Password
blue mode:
Merchant Account ID, Merchant ID, Public Key, Private Key

Onboarding Merchants in:

Adding a Braintree gateway

There are actually two different “modes” that you can use to authenticate with the Braintree gateway: Blue and Orange.

Blue Mode

You just need to supply a merchant_id, public_key, and private_key:


curl https://core.spreedly.com/v1/gateways.xml \
  -u 'Ll6fAtoVSTyVMlJEmtpoJV8S:RKOCG5D8D3fZxDSg504D0IxU2XD4Io5VXmyzdCtTivHFTTSy' \
  -H 'Content-Type: application/xml' \
  -d '<gateway>
        <gateway_type>braintree</gateway_type>
        <mode>blue</mode>
        <merchant_id>MyMerchantId</merchant_id>
        <public_key>MyPublicKey</public_key>
        <private_key>MyPrivateKey</private_key>
      </gateway>'

<gateway>
  <token>1Kfjha9tecTvmWRc4OBvpRBPh0U</token>
  <gateway_type>braintree</gateway_type>
  <name>Braintree</name>
  <description nil="true"/>
  <merchant_id>MyMerchantId</merchant_id>
  <public_key>MyPublicKey</public_key>
  <merchant_account_id nil="true"/>
  <characteristics>
    <supports_purchase type="boolean">true</supports_purchase>
    <supports_authorize type="boolean">true</supports_authorize>
    <supports_capture type="boolean">true</supports_capture>
    <supports_credit type="boolean">true</supports_credit>
    <supports_general_credit type="boolean">false</supports_general_credit>
    <supports_void type="boolean">true</supports_void>
    <supports_verify type="boolean">true</supports_verify>
    <supports_reference_purchase type="boolean">false</supports_reference_purchase>
    <supports_purchase_via_preauthorization type="boolean">false</supports_purchase_via_preauthorization>
    <supports_offsite_purchase type="boolean">false</supports_offsite_purchase>
    <supports_offsite_authorize type="boolean">false</supports_offsite_authorize>
    <supports_3dsecure_purchase type="boolean">false</supports_3dsecure_purchase>
    <supports_3dsecure_authorize type="boolean">false</supports_3dsecure_authorize>
    <supports_store type="boolean">true</supports_store>
    <supports_remove type="boolean">false</supports_remove>
    <supports_fraud_review type="boolean">false</supports_fraud_review>
    <supports_disburse type="boolean">false</supports_disburse>
  </characteristics>
  <credentials>
    <credential>
      <name>merchant_id</name>
      <value>MyMerchantId</value>
    </credential>
    <credential>
      <name>public_key</name>
      <value>MyPublicKey</value>
    </credential>
    <credential>
      <name>merchant_account_id</name>
      <value nil="true"/>
    </credential>
  </credentials>
  <gateway_specific_fields>
    <gateway_specific_field>descriptor_name</gateway_specific_field>
    <gateway_specific_field>descriptor_phone</gateway_specific_field>
    <gateway_specific_field>descriptor_url</gateway_specific_field>
    <gateway_specific_field>service_fee_amount</gateway_specific_field>
    <gateway_specific_field>merchant_account_id</gateway_specific_field>
    <gateway_specific_field>hold_in_escrow</gateway_specific_field>
    <gateway_specific_field>customer_id</gateway_specific_field>
  </gateway_specific_fields>
  <payment_methods>
    <payment_method>credit_card</payment_method>
    <payment_method>third_party_token</payment_method>
    <payment_method>apple_pay</payment_method>
    <payment_method>android_pay</payment_method>
  </payment_methods>
  <state>retained</state>
  <redacted type="boolean">false</redacted>
  <created_at type="dateTime">2016-08-11T17:14:08Z</created_at>
  <updated_at type="dateTime">2016-08-11T17:14:08Z</updated_at>
  <mode>blue</mode>
</gateway>


env = Spreedly::Environment.new('Ll6fAtoVSTyMlJEm', 'RKcG5D8D3fZxDSg504U2XD4Io5VXz')
env.add_gateway(:braintree, mode: 'blue', merchant_id: 'MyMerchantID',
               public_key: 'MyPublicKey', private_key: 'MyPrivateKey')


#<Spreedly::Gateway:0x007fa623a39fa0
 @created_at="2016-08-11T17:14:08Z",
 @credentials=
  {"merchant_id"=>"MyMerchantID",
   "public_key"=>"MyPublicKey",
   "merchant_account_id"=>""},
 @gateway_type="braintree",
 @name="Braintree",
 @state="retained",
 @token="ALxMvjxbptM36NHgfMbFDqul8qq",
 @updated_at="2016-08-11T17:14:08Z">

Blue Mode With Merchant Account ID

You can also optionally specify a merchant_account_id if you have multiple merchant accounts processing against the same Braintree gateway account. You can do so like this:


curl https://core.spreedly.com/v1/gateways.xml \
  -u 'Ll6fAtoVSTyVMlJEmtpoJV8S:RKOCG5D8D3fZxDSg504D0IxU2XD4Io5VXmyzdCtTivHFTTSy' \
  -H 'Content-Type: application/xml' \
  -d '<gateway>
        <gateway_type>braintree</gateway_type>
        <mode>blue</mode>
        <merchant_id>MyMerchantId</merchant_id>
        <public_key>MyPublicKey</public_key>
        <private_key>MyPrivateKey</private_key>
        <merchant_account_id>My Merchant Account ID</merchant_account_id>
      </gateway>'

<gateway>
  <token>Ms48Q7GinDdYvGCpPEB0kIszXxc</token>
  <gateway_type>braintree</gateway_type>
  <name>Braintree</name>
  <description nil="true"/>
  <merchant_id>MyMerchantId</merchant_id>
  <public_key>MyPublicKey</public_key>
  <merchant_account_id>My Merchant Account ID</merchant_account_id>
  <characteristics>
    <supports_purchase type="boolean">true</supports_purchase>
    <supports_authorize type="boolean">true</supports_authorize>
    <supports_capture type="boolean">true</supports_capture>
    <supports_credit type="boolean">true</supports_credit>
    <supports_general_credit type="boolean">false</supports_general_credit>
    <supports_void type="boolean">true</supports_void>
    <supports_verify type="boolean">true</supports_verify>
    <supports_reference_purchase type="boolean">false</supports_reference_purchase>
    <supports_purchase_via_preauthorization type="boolean">false</supports_purchase_via_preauthorization>
    <supports_offsite_purchase type="boolean">false</supports_offsite_purchase>
    <supports_offsite_authorize type="boolean">false</supports_offsite_authorize>
    <supports_3dsecure_purchase type="boolean">false</supports_3dsecure_purchase>
    <supports_3dsecure_authorize type="boolean">false</supports_3dsecure_authorize>
    <supports_store type="boolean">true</supports_store>
    <supports_remove type="boolean">false</supports_remove>
    <supports_fraud_review type="boolean">false</supports_fraud_review>
    <supports_disburse type="boolean">false</supports_disburse>
  </characteristics>
  <credentials>
    <credential>
      <name>merchant_id</name>
      <value>MyMerchantId</value>
    </credential>
    <credential>
      <name>public_key</name>
      <value>MyPublicKey</value>
    </credential>
    <credential>
      <name>merchant_account_id</name>
      <value>My Merchant Account ID</value>
    </credential>
  </credentials>
  <gateway_specific_fields>
    <gateway_specific_field>descriptor_name</gateway_specific_field>
    <gateway_specific_field>descriptor_phone</gateway_specific_field>
    <gateway_specific_field>descriptor_url</gateway_specific_field>
    <gateway_specific_field>service_fee_amount</gateway_specific_field>
    <gateway_specific_field>merchant_account_id</gateway_specific_field>
    <gateway_specific_field>hold_in_escrow</gateway_specific_field>
    <gateway_specific_field>customer_id</gateway_specific_field>
  </gateway_specific_fields>
  <payment_methods>
    <payment_method>credit_card</payment_method>
    <payment_method>third_party_token</payment_method>
    <payment_method>apple_pay</payment_method>
  </payment_methods>
  <state>retained</state>
  <redacted type="boolean">false</redacted>
  <created_at type="dateTime">2016-08-11T17:14:13Z</created_at>
  <updated_at type="dateTime">2016-08-11T17:14:13Z</updated_at>
  <mode>blue</mode>
</gateway>


env = Spreedly::Environment.new('Ll6fAtoVSTyMlJEm', 'RKcG5D8D3fZxDSg504U2XD4Io5VXz')
env.add_gateway(:braintree, mode: 'blue', merchant_id: 'MyMerchantID',
                public_key: 'MyPublicKey', private_key: 'MyPrivateKey',
                merchant_account_id: 'My Merchant Acount ID')


#<Spreedly::Gateway:0x007f8b13459ca0
 @created_at="2016-08-11T17:14:13Z",
 @credentials=
  {"merchant_id"=>"MyMerchantID",
   "public_key"=>"MyPublicKey",
   "merchant_account_id"=>"My Merchant Acount ID"},
 @gateway_type="braintree",
 @name="Braintree",
 @state="retained",
 @token="UPVqYkq0aUYp6B91l99USNJBRDY",
 @updated_at="2016-08-11T17:14:13Z">

Orange Mode

You just need to supply a login and password:


curl https://core.spreedly.com/v1/gateways.xml \
  -u 'Ll6fAtoVSTyVMlJEmtpoJV8S:RKOCG5D8D3fZxDSg504D0IxU2XD4Io5VXmyzdCtTivHFTTSy' \
  -H 'Content-Type: application/xml' \
  -d '<gateway>
        <gateway_type>braintree</gateway_type>
        <mode>orange</mode>
        <login>MyLogin</login>
        <password>MyPassword</password>
      </gateway>'

<gateway>
  <token>CxIocRCsOL5fqiUCXuGary1Dq1J</token>
  <gateway_type>braintree</gateway_type>
  <name>Braintree</name>
  <description nil="true"/>
  <login>MyLogin</login>
  <characteristics>
    <supports_purchase type="boolean">true</supports_purchase>
    <supports_authorize type="boolean">true</supports_authorize>
    <supports_capture type="boolean">true</supports_capture>
    <supports_credit type="boolean">true</supports_credit>
    <supports_general_credit type="boolean">false</supports_general_credit>
    <supports_void type="boolean">true</supports_void>
    <supports_verify type="boolean">true</supports_verify>
    <supports_reference_purchase type="boolean">false</supports_reference_purchase>
    <supports_purchase_via_preauthorization type="boolean">false</supports_purchase_via_preauthorization>
    <supports_offsite_purchase type="boolean">false</supports_offsite_purchase>
    <supports_offsite_authorize type="boolean">false</supports_offsite_authorize>
    <supports_3dsecure_purchase type="boolean">false</supports_3dsecure_purchase>
    <supports_3dsecure_authorize type="boolean">false</supports_3dsecure_authorize>
    <supports_store type="boolean">true</supports_store>
    <supports_remove type="boolean">false</supports_remove>
    <supports_fraud_review type="boolean">false</supports_fraud_review>
    <supports_disburse type="boolean">false</supports_disburse>
  </characteristics>
  <credentials>
    <credential>
      <name>login</name>
      <value>MyLogin</value>
    </credential>
  </credentials>
  <gateway_specific_fields>
    <gateway_specific_field>descriptor_name</gateway_specific_field>
    <gateway_specific_field>descriptor_phone</gateway_specific_field>
    <gateway_specific_field>descriptor_url</gateway_specific_field>
    <gateway_specific_field>service_fee_amount</gateway_specific_field>
    <gateway_specific_field>merchant_account_id</gateway_specific_field>
    <gateway_specific_field>hold_in_escrow</gateway_specific_field>
    <gateway_specific_field>customer_id</gateway_specific_field>
  </gateway_specific_fields>
  <payment_methods>
    <payment_method>credit_card</payment_method>
    <payment_method>third_party_token</payment_method>
    <payment_method>apple_pay</payment_method>
  </payment_methods>
  <state>retained</state>
  <redacted type="boolean">false</redacted>
  <created_at type="dateTime">2016-08-11T17:14:13Z</created_at>
  <updated_at type="dateTime">2016-08-11T17:14:14Z</updated_at>
  <mode>orange</mode>
</gateway>


env = Spreedly::Environment.new('Ll6fAtoVSTyMlJEm', 'RKcG5D8D3fZxDSg504U2XD4Io5VXz')
env.add_gateway(:braintree, mode: 'orange', login: 'MyLogin', password: 'MyPassword')


#<Spreedly::Gateway:0x007f8f748ee440
 @created_at="2016-08-11T17:14:14Z",
 @credentials={"login"=>"MyLogin"},
 @gateway_type="braintree",
 @name="Braintree",
 @state="retained",
 @token="3vuaMj8mmhOFEwCNfrkmWFgOkWZ",
 @updated_at="2016-08-11T17:14:14Z">

Optional Gateway Specific Fields

When interacting with a Braintree gateway to run transactions, there are some gateway specific fields you can specify.

Braintree Blue Customer ID

Braintree’s vault (when using the “blue” API) has a top-level concept of a Customer, and Core allows limited interaction with the Customer when storing credit cards in Braintree’s vault.

If you specify the customer id as a gateway specific field, Core will use that customer id when adding the card, and if the customer already exists it will add the card to the customer rather than throwing a duplicate customer error:


curl https://core.spreedly.com/v1/gateways/LlkjmEk0xNkcWrNixXa1fvNoTP4/store.xml \
  -u 'Ll6fAtoVSTyVMlJEmtpoJV8S:RKOCG5D8D3fZxDSg504D0IxU2XD4Io5VXmyzdCtTivHFTTSy' \
  -H 'Content-Type: application/xml' \
  -d '<transaction>
        <payment_method_token>56wyNnSmuA6CWYP7w0MiYCVIbW6</payment_method_token>
        <gateway_specific_fields>
          <braintree>
            <customer_id>103</customer_id>
          </braintree>
        </gateway_specific_fields>
      </transaction>'

<transaction>
  <created_at type="dateTime">2016-08-11T17:14:08Z</created_at>
  <updated_at type="dateTime">2016-08-11T17:14:09Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <token>JhjiALsRWXe9dUi0CSPQmk9iyro</token>
  <state>succeeded</state>
  <gateway_specific_fields>
    <braintree>
      <customer_id>103</customer_id>
    </braintree>
  </gateway_specific_fields>
  <gateway_specific_response_fields>
  </gateway_specific_response_fields>
  <transaction_type>Store</transaction_type>
  <third_party_token nil="true"/>
  <gateway_transaction_id>48</gateway_transaction_id>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>8dvNMSuDr3kTlMIQxbkIaE5KNlX</gateway_token>
  <payment_method>
    <token>J2HjfYXu8aMdr998q941wKAvOnS</token>
    <created_at type="dateTime">2016-08-11T17:14:08Z</created_at>
    <updated_at type="dateTime">2016-08-11T17:14:08Z</updated_at>
    <gateway_type>test</gateway_type>
    <storage_state>retained</storage_state>
    <third_party_token>test_vault:4111111111111111</third_party_token>
    <payment_method_type>third_party_token</payment_method_type>
    <errors>
    </errors>
  </payment_method>
  <basis_payment_method>
    <token>UAwoPyWJhwZiYe2ZY1ri6ENAjLG</token>
    <created_at type="dateTime">2016-08-11T17:09:30Z</created_at>
    <updated_at type="dateTime">2016-08-11T17:14:08Z</updated_at>
    <email nil="true"/>
    <data nil="true"/>
    <storage_state>retained</storage_state>
    <test type="boolean">true</test>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name>Robert</first_name>
    <last_name>Lemke</last_name>
    <month type="integer">4</month>
    <year type="integer">2020</year>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
    <company nil="true"/>
    <full_name>Robert Lemke</full_name>
    <eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
    <shipping_address1 nil="true"/>
    <shipping_address2 nil="true"/>
    <shipping_city nil="true"/>
    <shipping_state nil="true"/>
    <shipping_zip nil="true"/>
    <shipping_country nil="true"/>
    <shipping_phone_number nil="true"/>
    <payment_method_type>credit_card</payment_method_type>
    <errors>
    </errors>
    <verification_value></verification_value>
    <number>XXXX-XXXX-XXXX-1111</number>
    <fingerprint>b0a45066121c1f1a49b3a6ffc26caf2995db</fingerprint>
  </basis_payment_method>
  <response>
    <success type="boolean">true</success>
    <message>Successful store</message>
    <avs_code nil="true"/>
    <avs_message nil="true"/>
    <cvv_code nil="true"/>
    <cvv_message nil="true"/>
    <pending type="boolean">false</pending>
    <result_unknown type="boolean">false</result_unknown>
    <error_code></error_code>
    <error_detail nil="true"/>
    <cancelled type="boolean">false</cancelled>
    <fraud_review nil="true"/>
    <created_at type="dateTime">2016-08-11T17:14:08Z</created_at>
    <updated_at type="dateTime">2016-08-11T17:14:09Z</updated_at>
  </response>
</transaction>


env = Spreedly::Environment.new('Ll6fAtoVSTyMlJEm', 'RKcG5D8D3fZxDSg504U2XD4Io5VXz')
env.purchase_on_gateway("LlkjmEk0xNkcWrNixXa1fvNoTP4", "56wyNnSmuA6CWYP7w0MiYCVIbW6", 4432,
  gateway_specific_fields: {
    braintree: {
      customer_id: "103"
    }
  }
)


#<Spreedly::Purchase:0x007fd0f52a9db0
 @amount="4432",
 @created_at="2016-08-11T17:14:09Z",
 @currency_code="USD",
 @description="",
 @email="",
 @gateway_specific_fields={:braintree=>{:customer_id=>"103"}},
 @gateway_token="8dvNMSuDr3kTlMIQxbkIaE5KNlX",
 @gateway_transaction_id="46",
 @ip="",
 @merchant_location_descriptor="",
 @merchant_name_descriptor="",
 @message="Succeeded!",
 @on_test_gateway="true",
 @order_id="",
 @payment_method=
  #<Spreedly::CreditCard:0x007fd0f6128918
   @address1="",
   @address2="",
   @card_type="visa",
   @city="",
   @company="",
   @country="",
   @created_at="2016-08-11T17:09:30Z",
   @data="",
   @eligible_for_card_updater="",
   @email="",
   @errors=[],
   @fingerprint="b0a45066121c1f1a49b3a6ffc26caf2995db",
   @first_name="Robert",
   @first_six_digits="411111",
   @full_name="Robert Lemke",
   @last_four_digits="1111",
   @last_name="Lemke",
   @month="4",
   @number="XXXX-XXXX-XXXX-1111",
   @phone_number="",
   @state="",
   @storage_state="retained",
   @token="UAwoPyWJhwZiYe2ZY1ri6ENAjLG",
   @updated_at="2016-08-11T17:14:08Z",
   @verification_value="",
   @year="2020",
   @zip="">,
 @response=
  #<Spreedly::Response:0x007fd0f4af58a8
   @avs_code="",
   @avs_message="",
   @cancelled="false",
   @created_at="2016-08-11T17:14:09Z",
   @cvv_code="",
   @cvv_message="",
   @error_code="",
   @error_detail="",
   @fraud_review="",
   @message="Successful purchase",
   @pending="false",
   @success="true",
   @updated_at="2016-08-11T17:14:09Z">,
 @shipping_address=
  #<Spreedly::ShippingAddress:0x007fd0f4b14118
   @address1="",
   @address2="",
   @city="",
   @country="",
   @name="Robert Lemke",
   @phone_number="",
   @state="",
   @zip="">,
 @state="succeeded",
 @succeeded="true",
 @token="FpLgkWeo2hhTKsyKwCD9luTyWYs",
 @updated_at="2016-08-11T17:14:09Z">

Braintree Dynamic Descriptors

Braintree dynamic descriptors can be used by the merchant to define what will appear on the customer’s credit card statement for the purchase. You can specify the descriptor_name, descriptor_phone, and descriptor_url like so:


curl https://core.spreedly.com/v1/gateways/LlkjmEk0xNkcWrNixXa1fvNoTP4/purchase.xml \
  -u 'Ll6fAtoVSTyVMlJEmtpoJV8S:RKOCG5D8D3fZxDSg504D0IxU2XD4Io5VXmyzdCtTivHFTTSy' \
  -H 'Content-Type: application/xml' \
  -d '<transaction>
        <payment_method_token>56wyNnSmuA6CWYP7w0MiYCVIbW6</payment_method_token>
        <amount>100</amount>
        <currency_code>USD</currency_code>
        <gateway_specific_fields>
          <braintree>
            <descriptor_name>company*theproduct</descriptor_name>
            <descriptor_phone>1331131131</descriptor_phone>
            <descriptor_url>company.com</descriptor_url>
          </braintree>
        </gateway_specific_fields>
      </transaction>'

<transaction>
  <on_test_gateway type="boolean">true</on_test_gateway>
  <created_at type="dateTime">2016-08-11T17:14:09Z</created_at>
  <updated_at type="dateTime">2016-08-11T17:14:10Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <state>succeeded</state>
  <token>Hul9c5bskHwFeR6mU1dr3CG1K2E</token>
  <transaction_type>Purchase</transaction_type>
  <order_id nil="true"/>
  <ip nil="true"/>
  <description nil="true"/>
  <email nil="true"/>
  <merchant_name_descriptor nil="true"/>
  <merchant_location_descriptor nil="true"/>
  <gateway_specific_fields>
    <braintree>
      <descriptor_name>company*theproduct</descriptor_name>
      <descriptor_phone>1331131131</descriptor_phone>
      <descriptor_url>company.com</descriptor_url>
    </braintree>
  </gateway_specific_fields>
  <gateway_specific_response_fields>
  </gateway_specific_response_fields>
  <gateway_transaction_id>67</gateway_transaction_id>
  <amount type="integer">100</amount>
  <currency_code>USD</currency_code>
  <retain_on_success type="boolean">false</retain_on_success>
  <payment_method_added type="boolean">false</payment_method_added>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>8dvNMSuDr3kTlMIQxbkIaE5KNlX</gateway_token>
  <shipping_address>
    <name>Robert Lemke</name>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
  </shipping_address>
  <response>
    <success type="boolean">true</success>
    <message>Successful purchase</message>
    <avs_code nil="true"/>
    <avs_message nil="true"/>
    <cvv_code nil="true"/>
    <cvv_message nil="true"/>
    <pending type="boolean">false</pending>
    <result_unknown type="boolean">false</result_unknown>
    <error_code></error_code>
    <error_detail nil="true"/>
    <cancelled type="boolean">false</cancelled>
    <fraud_review nil="true"/>
    <created_at type="dateTime">2016-08-11T17:14:10Z</created_at>
    <updated_at type="dateTime">2016-08-11T17:14:10Z</updated_at>
  </response>
  <api_urls>
  </api_urls>
  <payment_method>
    <token>UAwoPyWJhwZiYe2ZY1ri6ENAjLG</token>
    <created_at type="dateTime">2016-08-11T17:09:30Z</created_at>
    <updated_at type="dateTime">2016-08-11T17:14:09Z</updated_at>
    <email nil="true"/>
    <data nil="true"/>
    <storage_state>retained</storage_state>
    <test type="boolean">true</test>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name>Robert</first_name>
    <last_name>Lemke</last_name>
    <month type="integer">4</month>
    <year type="integer">2020</year>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
    <company nil="true"/>
    <full_name>Robert Lemke</full_name>
    <eligible_for_card_updater nil="true"/>
    <shipping_address1 nil="true"/>
    <shipping_address2 nil="true"/>
    <shipping_city nil="true"/>
    <shipping_state nil="true"/>
    <shipping_zip nil="true"/>
    <shipping_country nil="true"/>
    <shipping_phone_number nil="true"/>
    <payment_method_type>credit_card</payment_method_type>
    <errors>
    </errors>
    <verification_value></verification_value>
    <number>XXXX-XXXX-XXXX-1111</number>
    <fingerprint>b0a45066121c1f1a49b3a6ffc26caf2995db</fingerprint>
  </payment_method>
</transaction>


env = Spreedly::Environment.new('Ll6fAtoVSTyMlJEm', 'RKcG5D8D3fZxDSg504U2XD4Io5VXz')
env.purchase_on_gateway("LlkjmEk0xNkcWrNixXa1fvNoTP4", "56wyNnSmuA6CWYP7w0MiYCVIbW6", 4432,
  gateway_specific_fields: {
    braintree: {
      descriptor_name: "company*theproduct",
      descriptor_phone: "1331131131"
    }
  }
)


#<Spreedly::Purchase:0x007fcae9301a18
 @amount="4432",
 @created_at="2016-08-11T17:14:10Z",
 @currency_code="USD",
 @description="",
 @email="",
 @gateway_specific_fields=
  {:braintree=>
    {:descriptor_name=>"company*theproduct", :descriptor_phone=>"1331131131"}},
 @gateway_token="8dvNMSuDr3kTlMIQxbkIaE5KNlX",
 @gateway_transaction_id="55",
 @ip="",
 @merchant_location_descriptor="",
 @merchant_name_descriptor="",
 @message="Succeeded!",
 @on_test_gateway="true",
 @order_id="",
 @payment_method=
  #<Spreedly::CreditCard:0x007fcae937c560
   @address1="",
   @address2="",
   @card_type="visa",
   @city="",
   @company="",
   @country="",
   @created_at="2016-08-11T17:09:30Z",
   @data="",
   @eligible_for_card_updater="",
   @email="",
   @errors=[],
   @fingerprint="b0a45066121c1f1a49b3a6ffc26caf2995db",
   @first_name="Robert",
   @first_six_digits="411111",
   @full_name="Robert Lemke",
   @last_four_digits="1111",
   @last_name="Lemke",
   @month="4",
   @number="XXXX-XXXX-XXXX-1111",
   @phone_number="",
   @state="",
   @storage_state="retained",
   @token="UAwoPyWJhwZiYe2ZY1ri6ENAjLG",
   @updated_at="2016-08-11T17:14:10Z",
   @verification_value="",
   @year="2020",
   @zip="">,
 @response=
  #<Spreedly::Response:0x007fcae9339558
   @avs_code="",
   @avs_message="",
   @cancelled="false",
   @created_at="2016-08-11T17:14:10Z",
   @cvv_code="",
   @cvv_message="",
   @error_code="",
   @error_detail="",
   @fraud_review="",
   @message="Successful purchase",
   @pending="false",
   @success="true",
   @updated_at="2016-08-11T17:14:10Z">,
 @shipping_address=
  #<Spreedly::ShippingAddress:0x007fcae937fd78
   @address1="",
   @address2="",
   @city="",
   @country="",
   @name="Robert Lemke",
   @phone_number="",
   @state="",
   @zip="">,
 @state="succeeded",
 @succeeded="true",
 @token="7IU0HAzShP2f9oRehzr3AfnbFac",
 @updated_at="2016-08-11T17:14:10Z">

Service Fee Amount

You can specify a service_fee_amount like so:


curl https://core.spreedly.com/v1/gateways/LlkjmEk0xNkcWrNixXa1fvNoTP4/purchase.xml \
  -u 'Ll6fAtoVSTyVMlJEmtpoJV8S:RKOCG5D8D3fZxDSg504D0IxU2XD4Io5VXmyzdCtTivHFTTSy' \
  -H 'Content-Type: application/xml' \
  -d '<transaction>
        <payment_method_token>56wyNnSmuA6CWYP7w0MiYCVIbW6</payment_method_token>
        <amount>100</amount>
        <currency_code>USD</currency_code>
        <gateway_specific_fields>
          <braintree>
            <service_fee_amount>23.44</service_fee_amount>
          </braintree>
        </gateway_specific_fields>
      </transaction>'

<transaction>
  <on_test_gateway type="boolean">true</on_test_gateway>
  <created_at type="dateTime">2016-08-11T17:14:14Z</created_at>
  <updated_at type="dateTime">2016-08-11T17:14:15Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <state>succeeded</state>
  <token>4g62G8pclsNxRgVgV0t0jRrFrQg</token>
  <transaction_type>Purchase</transaction_type>
  <order_id nil="true"/>
  <ip nil="true"/>
  <description nil="true"/>
  <email nil="true"/>
  <merchant_name_descriptor nil="true"/>
  <merchant_location_descriptor nil="true"/>
  <gateway_specific_fields>
    <braintree>
      <service_fee_amount>23.44</service_fee_amount>
    </braintree>
  </gateway_specific_fields>
  <gateway_specific_response_fields>
  </gateway_specific_response_fields>
  <gateway_transaction_id>53</gateway_transaction_id>
  <amount type="integer">100</amount>
  <currency_code>USD</currency_code>
  <retain_on_success type="boolean">false</retain_on_success>
  <payment_method_added type="boolean">false</payment_method_added>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>8dvNMSuDr3kTlMIQxbkIaE5KNlX</gateway_token>
  <shipping_address>
    <name>Robert Lemke</name>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
  </shipping_address>
  <response>
    <success type="boolean">true</success>
    <message>Successful purchase</message>
    <avs_code nil="true"/>
    <avs_message nil="true"/>
    <cvv_code nil="true"/>
    <cvv_message nil="true"/>
    <pending type="boolean">false</pending>
    <result_unknown type="boolean">false</result_unknown>
    <error_code></error_code>
    <error_detail nil="true"/>
    <cancelled type="boolean">false</cancelled>
    <fraud_review nil="true"/>
    <created_at type="dateTime">2016-08-11T17:14:14Z</created_at>
    <updated_at type="dateTime">2016-08-11T17:14:15Z</updated_at>
  </response>
  <api_urls>
  </api_urls>
  <payment_method>
    <token>UAwoPyWJhwZiYe2ZY1ri6ENAjLG</token>
    <created_at type="dateTime">2016-08-11T17:09:30Z</created_at>
    <updated_at type="dateTime">2016-08-11T17:14:12Z</updated_at>
    <email nil="true"/>
    <data nil="true"/>
    <storage_state>retained</storage_state>
    <test type="boolean">true</test>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name>Robert</first_name>
    <last_name>Lemke</last_name>
    <month type="integer">4</month>
    <year type="integer">2020</year>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
    <company nil="true"/>
    <full_name>Robert Lemke</full_name>
    <eligible_for_card_updater nil="true"/>
    <shipping_address1 nil="true"/>
    <shipping_address2 nil="true"/>
    <shipping_city nil="true"/>
    <shipping_state nil="true"/>
    <shipping_zip nil="true"/>
    <shipping_country nil="true"/>
    <shipping_phone_number nil="true"/>
    <payment_method_type>credit_card</payment_method_type>
    <errors>
    </errors>
    <verification_value></verification_value>
    <number>XXXX-XXXX-XXXX-1111</number>
    <fingerprint>b0a45066121c1f1a49b3a6ffc26caf2995db</fingerprint>
  </payment_method>
</transaction>


env = Spreedly::Environment.new('Ll6fAtoVSTyMlJEm', 'RKcG5D8D3fZxDSg504U2XD4Io5VXz')
env.purchase_on_gateway("LlkjmEk0xNkcWrNixXa1fvNoTP4", "56wyNnSmuA6CWYP7w0MiYCVIbW6", 4432,
  gateway_specific_fields: {
    braintree: {
      service_fee_amount: 23.44
    }
  }
)


#<Spreedly::Purchase:0x007fe37504dcf0
 @amount="4432",
 @created_at="2016-08-11T17:14:15Z",
 @currency_code="USD",
 @description="",
 @email="",
 @gateway_specific_fields={:braintree=>{:service_fee_amount=>"23.44"}},
 @gateway_token="8dvNMSuDr3kTlMIQxbkIaE5KNlX",
 @gateway_transaction_id="50",
 @ip="",
 @merchant_location_descriptor="",
 @merchant_name_descriptor="",
 @message="Succeeded!",
 @on_test_gateway="true",
 @order_id="",
 @payment_method=
  #<Spreedly::CreditCard:0x007fe374334898
   @address1="",
   @address2="",
   @card_type="visa",
   @city="",
   @company="",
   @country="",
   @created_at="2016-08-11T17:09:30Z",
   @data="",
   @eligible_for_card_updater="",
   @email="",
   @errors=[],
   @fingerprint="b0a45066121c1f1a49b3a6ffc26caf2995db",
   @first_name="Robert",
   @first_six_digits="411111",
   @full_name="Robert Lemke",
   @last_four_digits="1111",
   @last_name="Lemke",
   @month="4",
   @number="XXXX-XXXX-XXXX-1111",
   @phone_number="",
   @state="",
   @storage_state="retained",
   @token="UAwoPyWJhwZiYe2ZY1ri6ENAjLG",
   @updated_at="2016-08-11T17:14:14Z",
   @verification_value="",
   @year="2020",
   @zip="">,
 @response=
  #<Spreedly::Response:0x007fe3742f9838
   @avs_code="",
   @avs_message="",
   @cancelled="false",
   @created_at="2016-08-11T17:14:15Z",
   @cvv_code="",
   @cvv_message="",
   @error_code="",
   @error_detail="",
   @fraud_review="",
   @message="Successful purchase",
   @pending="false",
   @success="true",
   @updated_at="2016-08-11T17:14:15Z">,
 @shipping_address=
  #<Spreedly::ShippingAddress:0x007fe374314098
   @address1="",
   @address2="",
   @city="",
   @country="",
   @name="Robert Lemke",
   @phone_number="",
   @state="",
   @zip="">,
 @state="succeeded",
 @succeeded="true",
 @token="T3ZJjjwByxpIvl1y71mFhvjyQx0",
 @updated_at="2016-08-11T17:14:15Z">

Merchant Account Id

You can specify a per transaction merchant_account_id that will overide the merchant_account_id you set for the gateway like so:


curl https://core.spreedly.com/v1/gateways/LlkjmEk0xNkcWrNixXa1fvNoTP4/purchase.xml \
  -u 'Ll6fAtoVSTyVMlJEmtpoJV8S:RKOCG5D8D3fZxDSg504D0IxU2XD4Io5VXmyzdCtTivHFTTSy' \
  -H 'Content-Type: application/xml' \
  -d '<transaction>
        <payment_method_token>56wyNnSmuA6CWYP7w0MiYCVIbW6</payment_method_token>
        <amount>100</amount>
        <currency_code>USD</currency_code>
        <gateway_specific_fields>
          <braintree>
            <merchant_account_id>TheId</merchant_account_id>
          </braintree>
        </gateway_specific_fields>
      </transaction>'

<transaction>
  <on_test_gateway type="boolean">true</on_test_gateway>
  <created_at type="dateTime">2016-08-11T17:14:12Z</created_at>
  <updated_at type="dateTime">2016-08-11T17:14:12Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <state>succeeded</state>
  <token>CLNx17IqS2Z4bMqcIVJD1DVpCus</token>
  <transaction_type>Purchase</transaction_type>
  <order_id nil="true"/>
  <ip nil="true"/>
  <description nil="true"/>
  <email nil="true"/>
  <merchant_name_descriptor nil="true"/>
  <merchant_location_descriptor nil="true"/>
  <gateway_specific_fields>
    <braintree>
      <merchant_account_id>TheId</merchant_account_id>
    </braintree>
  </gateway_specific_fields>
  <gateway_specific_response_fields>
  </gateway_specific_response_fields>
  <gateway_transaction_id>51</gateway_transaction_id>
  <amount type="integer">100</amount>
  <currency_code>USD</currency_code>
  <retain_on_success type="boolean">false</retain_on_success>
  <payment_method_added type="boolean">false</payment_method_added>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>8dvNMSuDr3kTlMIQxbkIaE5KNlX</gateway_token>
  <shipping_address>
    <name>Robert Lemke</name>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
  </shipping_address>
  <response>
    <success type="boolean">true</success>
    <message>Successful purchase</message>
    <avs_code nil="true"/>
    <avs_message nil="true"/>
    <cvv_code nil="true"/>
    <cvv_message nil="true"/>
    <pending type="boolean">false</pending>
    <result_unknown type="boolean">false</result_unknown>
    <error_code></error_code>
    <error_detail nil="true"/>
    <cancelled type="boolean">false</cancelled>
    <fraud_review nil="true"/>
    <created_at type="dateTime">2016-08-11T17:14:12Z</created_at>
    <updated_at type="dateTime">2016-08-11T17:14:12Z</updated_at>
  </response>
  <api_urls>
  </api_urls>
  <payment_method>
    <token>UAwoPyWJhwZiYe2ZY1ri6ENAjLG</token>
    <created_at type="dateTime">2016-08-11T17:09:30Z</created_at>
    <updated_at type="dateTime">2016-08-11T17:14:11Z</updated_at>
    <email nil="true"/>
    <data nil="true"/>
    <storage_state>retained</storage_state>
    <test type="boolean">true</test>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name>Robert</first_name>
    <last_name>Lemke</last_name>
    <month type="integer">4</month>
    <year type="integer">2020</year>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
    <company nil="true"/>
    <full_name>Robert Lemke</full_name>
    <eligible_for_card_updater nil="true"/>
    <shipping_address1 nil="true"/>
    <shipping_address2 nil="true"/>
    <shipping_city nil="true"/>
    <shipping_state nil="true"/>
    <shipping_zip nil="true"/>
    <shipping_country nil="true"/>
    <shipping_phone_number nil="true"/>
    <payment_method_type>credit_card</payment_method_type>
    <errors>
    </errors>
    <verification_value></verification_value>
    <number>XXXX-XXXX-XXXX-1111</number>
    <fingerprint>b0a45066121c1f1a49b3a6ffc26caf2995db</fingerprint>
  </payment_method>
</transaction>


env = Spreedly::Environment.new('Ll6fAtoVSTyMlJEm', 'RKcG5D8D3fZxDSg504U2XD4Io5VXz')
env.purchase_on_gateway("LlkjmEk0xNkcWrNixXa1fvNoTP4", "56wyNnSmuA6CWYP7w0MiYCVIbW6", 4432,
  gateway_specific_fields: {
    braintree: {
      merchant_account_id: "TheID"
    }
  }
)


#<Spreedly::Purchase:0x007fe7d3055cb8
 @amount="4432",
 @created_at="2016-08-11T17:14:12Z",
 @currency_code="USD",
 @description="",
 @email="",
 @gateway_specific_fields={:braintree=>{:merchant_account_id=>"TheID"}},
 @gateway_token="8dvNMSuDr3kTlMIQxbkIaE5KNlX",
 @gateway_transaction_id="54",
 @ip="",
 @merchant_location_descriptor="",
 @merchant_name_descriptor="",
 @message="Succeeded!",
 @on_test_gateway="true",
 @order_id="",
 @payment_method=
  #<Spreedly::CreditCard:0x007fe7d30cc840
   @address1="",
   @address2="",
   @card_type="visa",
   @city="",
   @company="",
   @country="",
   @created_at="2016-08-11T17:09:30Z",
   @data="",
   @eligible_for_card_updater="",
   @email="",
   @errors=[],
   @fingerprint="b0a45066121c1f1a49b3a6ffc26caf2995db",
   @first_name="Robert",
   @first_six_digits="411111",
   @full_name="Robert Lemke",
   @last_four_digits="1111",
   @last_name="Lemke",
   @month="4",
   @number="XXXX-XXXX-XXXX-1111",
   @phone_number="",
   @state="",
   @storage_state="retained",
   @token="UAwoPyWJhwZiYe2ZY1ri6ENAjLG",
   @updated_at="2016-08-11T17:14:12Z",
   @verification_value="",
   @year="2020",
   @zip="">,
 @response=
  #<Spreedly::Response:0x007fe7d30817c8
   @avs_code="",
   @avs_message="",
   @cancelled="false",
   @created_at="2016-08-11T17:14:12Z",
   @cvv_code="",
   @cvv_message="",
   @error_code="",
   @error_detail="",
   @fraud_review="",
   @message="Successful purchase",
   @pending="false",
   @success="true",
   @updated_at="2016-08-11T17:14:12Z">,
 @shipping_address=
  #<Spreedly::ShippingAddress:0x007fe7d30a4048
   @address1="",
   @address2="",
   @city="",
   @country="",
   @name="Robert Lemke",
   @phone_number="",
   @state="",
   @zip="">,
 @state="succeeded",
 @succeeded="true",
 @token="NV5o9tHeiKgvPd0Z5hav1SJMzbd",
 @updated_at="2016-08-11T17:14:12Z">

Hold In Escrow

You can specify hold_in_escrow. This MUST be submitted with the merchant_account_id gateway_specific_field like so:


curl https://core.spreedly.com/v1/gateways/LlkjmEk0xNkcWrNixXa1fvNoTP4/purchase.xml \
  -u 'Ll6fAtoVSTyVMlJEmtpoJV8S:RKOCG5D8D3fZxDSg504D0IxU2XD4Io5VXmyzdCtTivHFTTSy' \
  -H 'Content-Type: application/xml' \
  -d '<transaction>
        <payment_method_token>56wyNnSmuA6CWYP7w0MiYCVIbW6</payment_method_token>
        <amount>100</amount>
        <currency_code>USD</currency_code>
        <gateway_specific_fields>
          <braintree>
            <merchant_account_id>TheId</merchant_account_id>
            <hold_in_escrow>true</hold_in_escrow>
          </braintree>
        </gateway_specific_fields>
      </transaction>'

<transaction>
  <on_test_gateway type="boolean">true</on_test_gateway>
  <created_at type="dateTime">2016-08-11T17:14:10Z</created_at>
  <updated_at type="dateTime">2016-08-11T17:14:11Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <state>succeeded</state>
  <token>8EGOSRXIPvsbP9FCuHEs1RE2Hpi</token>
  <transaction_type>Purchase</transaction_type>
  <order_id nil="true"/>
  <ip nil="true"/>
  <description nil="true"/>
  <email nil="true"/>
  <merchant_name_descriptor nil="true"/>
  <merchant_location_descriptor nil="true"/>
  <gateway_specific_fields>
    <braintree>
      <merchant_account_id>TheId</merchant_account_id>
      <hold_in_escrow>true</hold_in_escrow>
    </braintree>
  </gateway_specific_fields>
  <gateway_specific_response_fields>
  </gateway_specific_response_fields>
  <gateway_transaction_id>44</gateway_transaction_id>
  <amount type="integer">100</amount>
  <currency_code>USD</currency_code>
  <retain_on_success type="boolean">false</retain_on_success>
  <payment_method_added type="boolean">false</payment_method_added>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>8dvNMSuDr3kTlMIQxbkIaE5KNlX</gateway_token>
  <shipping_address>
    <name>Robert Lemke</name>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
  </shipping_address>
  <response>
    <success type="boolean">true</success>
    <message>Successful purchase</message>
    <avs_code nil="true"/>
    <avs_message nil="true"/>
    <cvv_code nil="true"/>
    <cvv_message nil="true"/>
    <pending type="boolean">false</pending>
    <result_unknown type="boolean">false</result_unknown>
    <error_code></error_code>
    <error_detail nil="true"/>
    <cancelled type="boolean">false</cancelled>
    <fraud_review nil="true"/>
    <created_at type="dateTime">2016-08-11T17:14:11Z</created_at>
    <updated_at type="dateTime">2016-08-11T17:14:11Z</updated_at>
  </response>
  <api_urls>
  </api_urls>
  <payment_method>
    <token>UAwoPyWJhwZiYe2ZY1ri6ENAjLG</token>
    <created_at type="dateTime">2016-08-11T17:09:30Z</created_at>
    <updated_at type="dateTime">2016-08-11T17:14:10Z</updated_at>
    <email nil="true"/>
    <data nil="true"/>
    <storage_state>retained</storage_state>
    <test type="boolean">true</test>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name>Robert</first_name>
    <last_name>Lemke</last_name>
    <month type="integer">4</month>
    <year type="integer">2020</year>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
    <company nil="true"/>
    <full_name>Robert Lemke</full_name>
    <eligible_for_card_updater nil="true"/>
    <shipping_address1 nil="true"/>
    <shipping_address2 nil="true"/>
    <shipping_city nil="true"/>
    <shipping_state nil="true"/>
    <shipping_zip nil="true"/>
    <shipping_country nil="true"/>
    <shipping_phone_number nil="true"/>
    <payment_method_type>credit_card</payment_method_type>
    <errors>
    </errors>
    <verification_value></verification_value>
    <number>XXXX-XXXX-XXXX-1111</number>
    <fingerprint>b0a45066121c1f1a49b3a6ffc26caf2995db</fingerprint>
  </payment_method>
</transaction>


env = Spreedly::Environment.new('Ll6fAtoVSTyMlJEm', 'RKcG5D8D3fZxDSg504U2XD4Io5VXz')
env.purchase_on_gateway("LlkjmEk0xNkcWrNixXa1fvNoTP4", "56wyNnSmuA6CWYP7w0MiYCVIbW6", 4432,
  gateway_specific_fields: {
    braintree: {
      merchant_account_id: "TheID",
      hold_in_escrow: true
    }
  }
)


#<Spreedly::Purchase:0x007fdb7b2f1be8
 @amount="4432",
 @created_at="2016-08-11T17:14:11Z",
 @currency_code="USD",
 @description="",
 @email="",
 @gateway_specific_fields=
  {:braintree=>{:merchant_account_id=>"TheID", :hold_in_escrow=>"true"}},
 @gateway_token="8dvNMSuDr3kTlMIQxbkIaE5KNlX",
 @gateway_transaction_id="60",
 @ip="",
 @merchant_location_descriptor="",
 @merchant_name_descriptor="",
 @message="Succeeded!",
 @on_test_gateway="true",
 @order_id="",
 @payment_method=
  #<Spreedly::CreditCard:0x007fdb7b334768
   @address1="",
   @address2="",
   @card_type="visa",
   @city="",
   @company="",
   @country="",
   @created_at="2016-08-11T17:09:30Z",
   @data="",
   @eligible_for_card_updater="",
   @email="",
   @errors=[],
   @fingerprint="b0a45066121c1f1a49b3a6ffc26caf2995db",
   @first_name="Robert",
   @first_six_digits="411111",
   @full_name="Robert Lemke",
   @last_four_digits="1111",
   @last_name="Lemke",
   @month="4",
   @number="XXXX-XXXX-XXXX-1111",
   @phone_number="",
   @state="",
   @storage_state="retained",
   @token="UAwoPyWJhwZiYe2ZY1ri6ENAjLG",
   @updated_at="2016-08-11T17:14:11Z",
   @verification_value="",
   @year="2020",
   @zip="">,
 @response=
  #<Spreedly::Response:0x007fdb7b301728
   @avs_code="",
   @avs_message="",
   @cancelled="false",
   @created_at="2016-08-11T17:14:11Z",
   @cvv_code="",
   @cvv_message="",
   @error_code="",
   @error_detail="",
   @fraud_review="",
   @message="Successful purchase",
   @pending="false",
   @success="true",
   @updated_at="2016-08-11T17:14:11Z">,
 @shipping_address=
  #<Spreedly::ShippingAddress:0x007fdb7b337f80
   @address1="",
   @address2="",
   @city="",
   @country="",
   @name="Robert Lemke",
   @phone_number="",
   @state="",
   @zip="">,
 @state="succeeded",
 @succeeded="true",
 @token="PeiXhM4ob8A3TQje468Z9ahznxN",
 @updated_at="2016-08-11T17:14:11Z">

Braintree Blue Additional Processor Response

If Braintree has activated it for your merchant account, you may receive authorization decline codes in the additional_processor_response field of a response.

<transaction>
  <token>LgpTNGjsWQs9DwdxcbreUVz0R8p</token>
  <transaction_type>Purchase</transaction_type>
  <gateway_specific_response_fields>
     <braintree>
       <additional_processor_response>2004</additional_processor_response>
     </braintree>
  </gateway_specific_response_fields>
</transaction>

Custom Fields

Custom fields provide an easy way to collect additional information about your customers or their purchase, like the name of the product they purchased. They can be included when creating a transaction or adding a customer to the Vault, and can be stored in the Braintree gateway for reporting purposes

Note that custom fields cannot be created via an API request so you’ll need to configure them directly in the Control Panel. See Braintree’s custom fields documentation for more information.


curl https://core.spreedly.com/v1/gateways/LlkjmEk0xNkcWrNixXa1fvNoTP4/purchase.xml \
  -u 'Ll6fAtoVSTyVMlJEmtpoJV8S:RKOCG5D8D3fZxDSg504D0IxU2XD4Io5VXmyzdCtTivHFTTSy' \
  -H 'Content-Type: application/xml' \
  -d '<transaction>
        <payment_method_token>56wyNnSmuA6CWYP7w0MiYCVIbW6</payment_method_token>
        <amount>100</amount>
        <currency_code>USD</currency_code>
        <gateway_specific_fields>
          <braintree>
            <custom_fields>
              <work_email>TheWorkEmail</work_email>
              <cat_name>Waffles</cat_name>
            </custom_fields>
          </braintree>
        </gateway_specific_fields>
      </transaction>'

<transaction>
  <on_test_gateway type="boolean">true</on_test_gateway>
  <created_at type="dateTime">2016-08-18T18:01:37Z</created_at>
  <updated_at type="dateTime">2016-08-18T18:01:37Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <state>succeeded</state>
  <token>A3ZpXUX35gD8klaleqNJ0AfyKxq</token>
  <transaction_type>Purchase</transaction_type>
  <order_id nil="true"/>
  <ip nil="true"/>
  <description nil="true"/>
  <email nil="true"/>
  <merchant_name_descriptor nil="true"/>
  <merchant_location_descriptor nil="true"/>
  <gateway_specific_fields>
    <braintree>
      <custom_fields>
        <work_email>TheWorkEmail</work_email>
        <cat_name>Waffles</cat_name>
      </custom_fields>
    </braintree>
  </gateway_specific_fields>
  <gateway_specific_response_fields>
  </gateway_specific_response_fields>
  <gateway_transaction_id>45</gateway_transaction_id>
  <amount type="integer">100</amount>
  <currency_code>USD</currency_code>
  <retain_on_success type="boolean">false</retain_on_success>
  <payment_method_added type="boolean">false</payment_method_added>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>ZL39sDXyufXI7VLXz97r66M70ul</gateway_token>
  <shipping_address>
    <name>Jorge Schaden</name>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
  </shipping_address>
  <response>
    <success type="boolean">true</success>
    <message>Successful purchase</message>
    <avs_code nil="true"/>
    <avs_message nil="true"/>
    <cvv_code nil="true"/>
    <cvv_message nil="true"/>
    <pending type="boolean">false</pending>
    <result_unknown type="boolean">false</result_unknown>
    <error_code></error_code>
    <error_detail nil="true"/>
    <cancelled type="boolean">false</cancelled>
    <fraud_review nil="true"/>
    <created_at type="dateTime">2016-08-18T18:01:37Z</created_at>
    <updated_at type="dateTime">2016-08-18T18:01:37Z</updated_at>
  </response>
  <api_urls>
  </api_urls>
  <payment_method>
    <token>PPRZJvAbnU8hQec2g8u3syNkHwn</token>
    <created_at type="dateTime">2016-08-18T14:24:55Z</created_at>
    <updated_at type="dateTime">2016-08-18T17:58:59Z</updated_at>
    <email nil="true"/>
    <data nil="true"/>
    <storage_state>retained</storage_state>
    <test type="boolean">true</test>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name>Jorge</first_name>
    <last_name>Schaden</last_name>
    <month type="integer">4</month>
    <year type="integer">2020</year>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
    <company nil="true"/>
    <full_name>Jorge Schaden</full_name>
    <eligible_for_card_updater nil="true"/>
    <shipping_address1 nil="true"/>
    <shipping_address2 nil="true"/>
    <shipping_city nil="true"/>
    <shipping_state nil="true"/>
    <shipping_zip nil="true"/>
    <shipping_country nil="true"/>
    <shipping_phone_number nil="true"/>
    <payment_method_type>credit_card</payment_method_type>
    <errors>
    </errors>
    <verification_value></verification_value>
    <number>XXXX-XXXX-XXXX-1111</number>
    <fingerprint>83f40937d2999755702b933cf96ebb74644b</fingerprint>
  </payment_method>
</transaction>


env = Spreedly::Environment.new('Ll6fAtoVSTyMlJEm', 'RKcG5D8D3fZxDSg504U2XD4Io5VXz')
env.purchase_on_gateway("LlkjmEk0xNkcWrNixXa1fvNoTP4", "56wyNnSmuA6CWYP7w0MiYCVIbW6", 4432,
  gateway_specific_fields: {
    braintree: {
      custom_fields: {
        work_email: "TheWorkEmail",
        cat_name: "Waffles"
      }
    }
  }
)


#<Spreedly::Purchase:0x007fae9d11c378
 @amount="4432",
 @created_at="2016-08-18T17:58:57Z",
 @currency_code="USD",
 @description="",
 @email="",
 @gateway_specific_fields=
  {:braintree=>
    {:custom_fields=>"\n        TheWorkEmail\n        Waffles\n      "}},
 @gateway_token="ZL39sDXyufXI7VLXz97r66M70ul",
 @gateway_transaction_id="66",
 @ip="",
 @merchant_location_descriptor="",
 @merchant_name_descriptor="",
 @message="Succeeded!",
 @on_test_gateway="true",
 @order_id="",
 @payment_method=
  #<Spreedly::CreditCard:0x007fae9bb66ee8
   @address1="",
   @address2="",
   @card_type="visa",
   @city="",
   @company="",
   @country="",
   @created_at="2016-08-18T14:24:55Z",
   @data="",
   @eligible_for_card_updater="",
   @email="",
   @errors=[],
   @fingerprint="83f40937d2999755702b933cf96ebb74644b",
   @first_name="Jorge",
   @first_six_digits="411111",
   @full_name="Jorge Schaden",
   @last_four_digits="1111",
   @last_name="Schaden",
   @month="4",
   @number="XXXX-XXXX-XXXX-1111",
   @phone_number="",
   @state="",
   @storage_state="retained",
   @token="PPRZJvAbnU8hQec2g8u3syNkHwn",
   @updated_at="2016-08-18T14:24:55Z",
   @verification_value="",
   @year="2020",
   @zip="">,
 @response=
  #<Spreedly::Response:0x007fae9bb1fe58
   @avs_code="",
   @avs_message="",
   @cancelled="false",
   @created_at="2016-08-18T17:58:57Z",
   @cvv_code="",
   @cvv_message="",
   @error_code="",
   @error_detail="",
   @fraud_review="",
   @message="Successful purchase",
   @pending="false",
   @success="true",
   @updated_at="2016-08-18T17:58:57Z">,
 @shipping_address=
  #<Spreedly::ShippingAddress:0x007fae9bb3e6c8
   @address1="",
   @address2="",
   @city="",
   @country="",
   @name="Jorge Schaden",
   @phone_number="",
   @state="",
   @zip="">,
 @state="succeeded",
 @succeeded="true",
 @token="XzvHekwz4X2WgofM1MKihqu2gbn",
 @updated_at="2016-08-18T17:58:57Z">

Recurring

By default, Spreedly sets the recurring flag true for transactions whose payment method lacks a cvv value. Under certain circumsatnces (like for instance when using prepaid cards), this may not be desirable. Set this optional gateway specific field to false to explicitly disable the recurring flag.


curl https://core.spreedly.com/v1/gateways/LlkjmEk0xNkcWrNixXa1fvNoTP4/purchase.xml \
  -u 'Ll6fAtoVSTyVMlJEmtpoJV8S:RKOCG5D8D3fZxDSg504D0IxU2XD4Io5VXmyzdCtTivHFTTSy' \
  -H 'Content-Type: application/xml' \
  -d '<transaction>
        <payment_method_token>56wyNnSmuA6CWYP7w0MiYCVIbW6</payment_method_token>
        <amount>100</amount>
        <currency_code>USD</currency_code>
        <gateway_specific_fields>
          <braintree>
            <recurring>false</recurring>
          </braintree>
        </gateway_specific_fields>
      </transaction>'

<transaction>
  <on_test_gateway type="boolean">true</on_test_gateway>
  <created_at type="dateTime">2017-01-20T20:34:54Z</created_at>
  <updated_at type="dateTime">2017-01-20T20:34:54Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <state>succeeded</state>
  <token>M6LZgiBY7d917tICtGhRTB9cxvS</token>
  <transaction_type>Purchase</transaction_type>
  <order_id nil="true"/>
  <ip nil="true"/>
  <description nil="true"/>
  <email nil="true"/>
  <merchant_name_descriptor nil="true"/>
  <merchant_location_descriptor nil="true"/>
  <gateway_specific_fields>
    <braintree>
      <recurring>false</recurring>
    </braintree>
  </gateway_specific_fields>
  <gateway_specific_response_fields>
  </gateway_specific_response_fields>
  <gateway_transaction_id>68</gateway_transaction_id>
  <amount type="integer">100</amount>
  <currency_code>USD</currency_code>
  <retain_on_success type="boolean">false</retain_on_success>
  <payment_method_added type="boolean">false</payment_method_added>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>QozJVf3SHEucJn0U1PipLsgkXDa</gateway_token>
  <shipping_address>
    <name>Muhammad Gutmann</name>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
  </shipping_address>
  <response>
    <success type="boolean">true</success>
    <message>Successful purchase</message>
    <avs_code nil="true"/>
    <avs_message nil="true"/>
    <cvv_code nil="true"/>
    <cvv_message nil="true"/>
    <pending type="boolean">false</pending>
    <result_unknown type="boolean">false</result_unknown>
    <error_code></error_code>
    <error_detail nil="true"/>
    <cancelled type="boolean">false</cancelled>
    <fraud_review nil="true"/>
    <created_at type="dateTime">2017-01-20T20:34:54Z</created_at>
    <updated_at type="dateTime">2017-01-20T20:34:54Z</updated_at>
  </response>
  <api_urls>
  </api_urls>
  <payment_method>
    <token>K0hUP70AU4YAiLoLql2jafLWvh8</token>
    <created_at type="dateTime">2016-12-29T16:45:03Z</created_at>
    <updated_at type="dateTime">2017-01-12T15:43:26Z</updated_at>
    <email nil="true"/>
    <data nil="true"/>
    <storage_state>retained</storage_state>
    <test type="boolean">true</test>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name>Muhammad</first_name>
    <last_name>Gutmann</last_name>
    <month type="integer">4</month>
    <year type="integer">2020</year>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
    <company nil="true"/>
    <full_name>Muhammad Gutmann</full_name>
    <eligible_for_card_updater nil="true"/>
    <shipping_address1 nil="true"/>
    <shipping_address2 nil="true"/>
    <shipping_city nil="true"/>
    <shipping_state nil="true"/>
    <shipping_zip nil="true"/>
    <shipping_country nil="true"/>
    <shipping_phone_number nil="true"/>
    <payment_method_type>credit_card</payment_method_type>
    <errors>
    </errors>
    <verification_value></verification_value>
    <number>XXXX-XXXX-XXXX-1111</number>
    <fingerprint nil="true"/>
  </payment_method>
</transaction>


env = Spreedly::Environment.new('Ll6fAtoVSTyMlJEm', 'RKcG5D8D3fZxDSg504U2XD4Io5VXz')
env.purchase_on_gateway("LlkjmEk0xNkcWrNixXa1fvNoTP4", "56wyNnSmuA6CWYP7w0MiYCVIbW6", 4432,
  gateway_specific_fields: {
    braintree: {
      recurring: "false"
    }
  }
)


#<Spreedly::Purchase:0x007faada1bc128
 @amount="4432",
 @created_at="2017-01-20T20:34:56Z",
 @currency_code="USD",
 @description="",
 @email="",
 @gateway_specific_fields={:braintree=>{:recurring=>"false"}},
 @gateway_token="QozJVf3SHEucJn0U1PipLsgkXDa",
 @gateway_transaction_id="53",
 @ip="",
 @merchant_location_descriptor="",
 @merchant_name_descriptor="",
 @message="Succeeded!",
 @on_test_gateway="true",
 @order_id="",
 @payment_method=
  #<Spreedly::CreditCard:0x007faadb2435a0
   @address1="",
   @address2="",
   @card_type="visa",
   @city="",
   @company="",
   @country="",
   @created_at="2016-12-29T16:45:03Z",
   @data="",
   @eligible_for_card_updater="",
   @email="",
   @errors=[],
   @fingerprint="",
   @first_name="Muhammad",
   @first_six_digits="411111",
   @full_name="Muhammad Gutmann",
   @last_four_digits="1111",
   @last_name="Gutmann",
   @month="4",
   @number="XXXX-XXXX-XXXX-1111",
   @phone_number="",
   @state="",
   @storage_state="retained",
   @token="K0hUP70AU4YAiLoLql2jafLWvh8",
   @updated_at="2017-01-20T20:34:54Z",
   @verification_value="",
   @year="2020",
   @zip="">,
 @response=
  #<Spreedly::Response:0x007faadb251f10
   @avs_code="",
   @avs_message="",
   @cancelled="false",
   @created_at="2017-01-20T20:34:56Z",
   @cvv_code="",
   @cvv_message="",
   @error_code="",
   @error_detail="",
   @fraud_review="",
   @message="Successful purchase",
   @pending="false",
   @success="true",
   @updated_at="2017-01-20T20:34:56Z">,
 @shipping_address=
  #<Spreedly::ShippingAddress:0x007faadb247ba0
   @address1="",
   @address2="",
   @city="",
   @country="",
   @name="Muhammad Gutmann",
   @phone_number="",
   @state="",
   @zip="">,
 @state="succeeded",
 @succeeded="true",
 @token="VupZbL4FY8pgzSnR8aLTIXDAGiF",
 @updated_at="2017-01-20T20:34:56Z">

If you’d like to request any gateway_specific_fields or gateway_specific_response_fields, please email support@spreedly.com with your request and the gateway documentation for the fields of interest.