Open jasonbrookins opened 5 years ago
Transaction Procedure:
Payment method nonce The payment method nonce is a string returned by the client SDK to represent a payment method. This string is a reference to the customer payment method details that were provided in your payment form and should be sent to your server where it can be used with the server SDKs to create a new transaction request.
To setup braintree Configure the environment and API credentials:
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('use_your_merchant_id');
Braintree_Configuration::publicKey('use_your_public_key');
Braintree_Configuration::privateKey('use_your_private_key');
BraintreeGateway gateway = new BraintreeGateway(
Environment.SANDBOX,
"your_merchant_id",
"your_public_key",
"your_private_key"
);
BraintreeGateway gateway = new BraintreeGateway(
Environment.PRODUCTION,
"YOUR_PRODUCTION_MERCHANT_ID",
"YOUR_PRODUCTION_PUBLIC_KEY",
"YOUR_PRODUCTION_PRIVATE_KEY"
);
https://developers.braintreepayments.com/reference/request/transaction/sale/java#credit_card
TransactionRequest request = new TransactionRequest()
.amount(new BigDecimal("10.00"))
.orderId("order id")
.merchantAccountId("a_merchant_account_id")
.paymentMethodNonce(nonceFromTheClient)
.customer()
.firstName("Drew")
.lastName("Smith")
.company("Braintree")
.phone("312-555-1234")
.fax("312-555-1235")
.website("http://www.example.com")
.email("drew@example.com")
.done()
.billingAddress()
.firstName("Paul")
.lastName("Smith")
.company("Braintree")
.streetAddress("1 E Main St")
.extendedAddress("Suite 403")
.locality("Chicago")
.region("IL")
.postalCode("60622")
.countryCodeAlpha2("US")
.done()
.shippingAddress()
.firstName("Jen")
.lastName("Smith")
.company("Braintree")
.streetAddress("1 E 1st St")
.extendedAddress("Suite 403")
.locality("Bartlett")
.region("IL")
.postalCode("60103")
.countryCodeAlpha2("US")
.done()
.options()
.submitForSettlement(true)
.done();
Result<Transaction> result = gateway.transaction().sale(request);
The /api/gateway/braintree.cfc
has been rewritten to use the Java SDK 2.96.0.
Files to be updated:
api/core.cfc
api/gateway/base.cfc
api/gateway/braintree/braintree.cfc
api/model/creditcard.cfc
jars/braintreeTest.cfm2.96.0.jar
Update: These files have been added to CFPayment, so they are, in theory, ready to be utilized (after minor testing).
@jazzjeff : The steps for setting up a production Braintree account are here: https://developers.braintreepayments.com/start/go-live/
The CFPayment Braintree gateway needs this information below PLUS the "Merchant Account ID" (which is the user-generated name for the account, not to be confused with the "Merchant ID" which is a number generated by Braintree) (see admin screenshot). The environment will be "Sandbox" if TestMode
is set to true
for the payment processor; otherwise it will be "Production":
BraintreeGateway gateway = new BraintreeGateway(
Environment.PRODUCTION,
"YOUR_PRODUCTION_MERCHANT_ID",
"YOUR_PRODUCTION_PUBLIC_KEY",
"YOUR_PRODUCTION_PRIVATE_KEY"
);
The admin screen for the Braintree payment processor looks like this (currently with my Sandbox credentials):
The Braintree admin area where this information can be found looks like this (at least for my Sandbox account):
@jazzjeff : Their documents say this about testing the production account:
"It is important to test your production account by creating a couple of low-value sale transactions for each of the payment method types you plan to accept. Be sure to submit the transactions for settlement (Note: we mark them for settlement automatically), and then confirm that the funds have deposited into your bank account. This typically happens a few days after they have settled."
The current Braintree gateway is older and uses the "Orange" mode instead of the newer "Blue" mode (the difference is largely in the user credentials - the former only used a username/password; the latter uses public/private keys).
There are java packages for it here:
https://developers.braintreepayments.com/start/hello-server/java https://developers.braintreepayments.com/client_libraries/java/braintree-java-2.95.0.jar
https://developers.braintreepayments.com/reference/request/payment-method/create/java#examples
So, the java methods need to be fed CFPayment information coming in and return the transaction response in CFPayment structures. Testing the implementation is going to be difficult, as well.