Here's the notes that Peter Bell provided me, this is to use the sample code straight up (which is a CFC that wraps the Java library that Braintree makes available here:
https://github.com/braintree/braintree_java - you can get jars from the "releases" link).
What needs to be done for cfpayment is to take the CFC that Peter wrote as a wrapper and just massage the parameters and method names to line up with the cfpayment standards. It should be trivial since I've already written a braintree orange gateway to model it after. The unit tests I wrote should work as I believe Braintree maintained the same values to generate declines/AVS/CVV matches/etc:
Braintree CFDML Library
Background
This is a library that wraps the Java Braintree library using Mark Mandell's Java Loader, so if you are more comfortable working directly with the Java library, feel free. The goal of this library is to expose most of the Java library in a way that will be slightly easier to consume.
Capabilities
There are two interfaces to the Braintree payment gateway. One uses a "Transparent Redirect" (TR) where the user fills out a form on your site and the form is posted directly to Braintree. Braintree then redirects the user to your site along with information in the URL about the success of the attempted transaction. The purpose of TR is to avoid cardholder data hitting your server to lower PCI DSS compliance costs by trying to keep your server environment out of scope. As such, you only need to do it when cardholder data is involved.
All other transactions will be submitted using a more standard server to server call where you will make requests against a different set of URLs on the Braintree servers using a token to identify the card that you wish to charge. (You *can* pass credit card information using a server to server call - but it will put your site in scope for PCI DSS compliance so these docs won't focus on that use case).
Installation
Start by downloading the project and create a mapping for your website titled "braintreecfml" pointing to the root directory of this project.
Registration
Before you can work with the Braintree API, you'll need a merchant Id, a private key and a public key. Contact Braintree to get the information required.
Your First Payment Form
Once you have the project installed and credentials from Braintree, the first thing you probably want to do is to create a form to allow a user to submit their credit card data and (probably) to make a payment at the same time. As with anything using the library, you will want to start by instantiating the braintreeGateway object which is the interface you use for all operations. Think of it as a factory for creating all of the objects you need. Because it acts as a factory, you can create a single instance of this either as a Singleton through ColdSpring or Lightwire, or you could just instantiate it in the application scope:
<cfset configuration = {
environment = "SANDBOX",
merchantId = "<your-merchand-Id>",
privateKey = "<your-private-key>",
publicKey = "<your-public-key>"
}>
<cfset braintreeGateway = createobject( "component", "braintreecfml.com.BraintreeGateway").init( argumentCollection=configuration )>
Now that we've done this, we need to create a payment form. This form is for storing a new customer (along with their card data) in the vault and charging that card.
<form action="#braintreeGateway.createCustomerUrl()#" method="post">
<label for="transaction_credit_card_number">Card Number</label>
<input type="text" id="transaction_credit_card_number" name="transaction[credit_card][number]" value="4111111111111111" />
<br /><br />
<label for="transaction_credit_card_expiration_date">Expiration Date</label>
<input type="text" id="transaction_credit_card_expiration_date" name="transaction[credit_card][expiration_date]" value="07/10" />
<br /><br />
<input type="hidden" name="tr_data" value="#braintreeGateway.trCreateandChargeCustomerv( amount, redirect_url )#" />
<input type="submit">
</form>
So we are calling the createCustomerUrl() method on braintreeGateway to get the URL for submitting a form to when we want to create a customer. We are putting the minimum fields required for making a payment (credit card number and expiration date) and we're calling trCreateandChargeCustomer() which creates and returns the necessary tr_Data to create and charge a customer (including storing the customer in the vault).
Gateway returns gateways for address, credit card, customer, subscription and transactions
Customer has transparentRedirectURLForCreate and transparentRedirectURLForUpdate