com.braintreegateway
Class BraintreeGateway

java.lang.Object
  extended by com.braintreegateway.BraintreeGateway

public class BraintreeGateway
extends Object

This is the primary interface to the Braintree Gateway. It is used to interact with:

Quick Start Example:
 import java.math.BigDecimal;
 import com.braintreegateway.*;

 public class BraintreeExample {

     public static void main(String[] args) {
         BraintreeGateway gateway = new BraintreeGateway(Environment.SANDBOX, "the_merchant_id", "the_public_key", "the_private_key");

         TransactionRequest request = new TransactionRequest().amount(new BigDecimal("100.00")).creditCard().number("4111111111111111").expirationDate("05/2012").done();

         Transaction transaction = gateway.transaction().sale(request).getTarget();
         System.out.println("Transaction ID: " + transaction.getId());
         System.out.println("Status: " + transaction.getStatus());
     }
 }
 


Field Summary
private  Configuration configuration
           
private  Environment environment
           
private  Http http
           
private  String merchantId
           
private  String privateKey
           
private  String publicKey
           
static String VERSION
           
 
Constructor Summary
BraintreeGateway(Environment environment, String merchantId, String publicKey, String privateKey)
          Instantiates a BraintreeGateway.
 
Method Summary
 AddOnGateway addOn()
          Returns an AddOnGateway for interacting with AddOn objects.
 AddressGateway address()
          Returns an AddressGateway for interacting with Address objects.
 String baseMerchantURL()
           
 CreditCardGateway creditCard()
          Returns an CreditCardGateway for interacting with CreditCard objects.
 CreditCardVerificationGateway creditCardVerification()
           
 CustomerGateway customer()
          Returns an CustomerGateway for interacting with Customer objects.
 DiscountGateway discount()
          Returns an DiscountGateway for interacting with Discount objects.
 String getAuthorizationHeader()
           
 Configuration getConfiguration()
           
 MerchantAccountGateway merchantAccount()
          Returns an MerchantAccountGateway for interacting with MerchantAccount objects.
 PlanGateway plan()
          Returns an PlanGateway for interacting with Plan objects.
 SettlementBatchSummaryGateway settlementBatchSummary()
           
 SubscriptionGateway subscription()
          Returns an SubscriptionGateway for interacting with Subscription objects.
 TransactionGateway transaction()
          Returns an TransactionGateway for interacting with Transaction objects.
 TransparentRedirectGateway transparentRedirect()
           
 String trData(Request trData, String redirectURL)
          Returns encoded transparent redirect data for the given Request and redirect URL
 WebhookNotificationGateway webhookNotification()
           
 WebhookTestingGateway webhookTesting()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final String VERSION

configuration

private Configuration configuration

environment

private Environment environment

http

private Http http

merchantId

private String merchantId

privateKey

private String privateKey

publicKey

private String publicKey
Constructor Detail

BraintreeGateway

public BraintreeGateway(Environment environment,
                        String merchantId,
                        String publicKey,
                        String privateKey)
Instantiates a BraintreeGateway. Use the values provided by Braintree.

Parameters:
environment - Either Environment.SANDBOX or Environment.PRODUCTION.
merchantId - the merchant id provided by Braintree.
publicKey - the public key provided by Braintree.
privateKey - the private key provided by Braintree.
Method Detail

addOn

public AddOnGateway addOn()
Returns an AddOnGateway for interacting with AddOn objects.

Returns:
an AddOnGateway.

address

public AddressGateway address()
Returns an AddressGateway for interacting with Address objects.

Returns:
an AddressGateway.

baseMerchantURL

public String baseMerchantURL()

creditCard

public CreditCardGateway creditCard()
Returns an CreditCardGateway for interacting with CreditCard objects.

Returns:
an CreditCardGateway.

creditCardVerification

public CreditCardVerificationGateway creditCardVerification()

customer

public CustomerGateway customer()
Returns an CustomerGateway for interacting with Customer objects.

Returns:
an CustomerGateway.

discount

public DiscountGateway discount()
Returns an DiscountGateway for interacting with Discount objects.

Returns:
an DiscountGateway.

getAuthorizationHeader

public String getAuthorizationHeader()

getConfiguration

public Configuration getConfiguration()

plan

public PlanGateway plan()
Returns an PlanGateway for interacting with Plan objects.

Returns:
an PlanGateway.

settlementBatchSummary

public SettlementBatchSummaryGateway settlementBatchSummary()

subscription

public SubscriptionGateway subscription()
Returns an SubscriptionGateway for interacting with Subscription objects.

Returns:
an SubscriptionGateway.

transaction

public TransactionGateway transaction()
Returns an TransactionGateway for interacting with Transaction objects.

Returns:
an TransactionGateway.

transparentRedirect

public TransparentRedirectGateway transparentRedirect()

trData

public String trData(Request trData,
                     String redirectURL)
Returns encoded transparent redirect data for the given Request and redirect URL

Parameters:
trData - the transparent redirect data as a Request object.
redirectURL - the redirect URL for the user after the transparent redirect POST.
Returns:
a String of encoded transparent redirect data.

webhookNotification

public WebhookNotificationGateway webhookNotification()

webhookTesting

public WebhookTestingGateway webhookTesting()

merchantAccount

public MerchantAccountGateway merchantAccount()
Returns an MerchantAccountGateway for interacting with MerchantAccount objects.

Returns:
an MerchantAccountGateway.


Copyright © 2013. All Rights Reserved.