Braintree

Since Camel 2.17

Only producer is supported

The Braintree component provides access to Braintree Payments trough through theirs Java SDK.

All client applications need API credential in order to process payments. In order to use camel-braintree with your account, you’ll need to create a new Sandbox or Production account.

Maven users will need to add the following dependency to their pom.xml for this component:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-braintree</artifactId>
    <version>${camel-version}</version>
</dependency>

Configuring Options

Camel components are configured on two separate levels:

  • component level

  • endpoint level

Configuring Component Options

The component level is the highest level which holds general and common configurations that are inherited by the endpoints. For example a component may have security settings, credentials for authentication, urls for network connection and so forth.

Some components only have a few options, and others may have many. Because components typically have pre configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.

Configuring components can be done with the Component DSL, in a configuration file (application.properties|yaml), or directly with Java code.

Configuring Endpoint Options

Where you find yourself configuring the most is on endpoints, as endpoints often have many options, which allows you to configure what you need the endpoint to do. The options are also categorized into whether the endpoint is used as consumer (from) or as a producer (to), or used for both.

Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL as a type safe way of configuring endpoints.

A good practice when configuring options is to use Property Placeholders, which allows to not hardcode urls, port numbers, sensitive information, and other settings. In other words placeholders allows to externalize the configuration from your code, and gives more flexibility and reuse.

The following two sections lists all the options, firstly for the component followed by the endpoint.

Component Options

The Braintree component supports 3 options, which are listed below.

Name Description Default Type

lazyStartProducer (producer)

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

boolean

autowiredEnabled (advanced)

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

boolean

configuration (advanced)

Component configuration.

BraintreeConfiguration

Endpoint Options

The Braintree endpoint is configured using URI syntax:

braintree:apiName/methodName

with the following path and query parameters:

Path Parameters (2 parameters)

Name Description Default Type

apiName (producer)

Required What kind of operation to perform.

Enum values:

  • ADD_ON

  • ADDRESS

  • CLIENT_TOKEN

  • CREDIT_CARD_VERIFICATION

  • CUSTOMER

  • DISCOUNT

  • DISPUTE

  • DOCUMENT_UPLOAD

  • MERCHANT_ACCOUNT

  • PAYMENT_METHOD

  • PAYMENT_METHOD_NONCE

  • PLAN

  • REPORT

  • SETTLEMENT_BATCH_SUMMARY

  • SUBSCRIPTION

  • TRANSACTION

  • WEBHOOK_NOTIFICATION

BraintreeApiName

methodName (producer)

Required What sub operation to use for the selected operation.

Enum values:

  • accept

  • addFileEvidence

  • addTextEvidence

  • cancel

  • cancelRelease

  • cloneTransaction

  • create

  • createForCurrency

  • credit

  • delete

  • fetchMerchantAccounts

  • finalize

  • find

  • generate

  • grant

  • holdInEscrow

  • parse

  • refund

  • releaseFromEscrow

  • removeEvidence

  • retryCharge

  • revoke

  • sale

  • search

  • submitForPartialSettlement

  • submitForSettlement

  • transactionLevelFees

  • update

  • updateDetails

  • verify

  • voidTransaction

String

Query Parameters (13 parameters)

Name Description Default Type

environment (producer)

The environment Either SANDBOX or PRODUCTION.

String

inBody (producer)

Sets the name of a parameter to be passed in the exchange In Body.

String

lazyStartProducer (producer)

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

boolean

merchantId (producer)

The merchant id provided by Braintree.

String

httpReadTimeout (advanced)

Set read timeout for http calls.

Integer

httpLogLevel (logging)

Set logging level for http calls, see java.util.logging.Level.

Enum values:

  • OFF

  • SEVERE

  • WARNING

  • INFO

  • CONFIG

  • FINE

  • FINER

  • FINEST

  • ALL

String

httpLogName (logging)

Set log category to use to log http calls.

String

logHandlerEnabled (logging)

Sets whether to enable the BraintreeLogHandler. It may be desirable to set this to 'false' where an existing JUL - SLF4J logger bridge is on the classpath. This option can also be configured globally on the BraintreeComponent.

boolean

proxyHost (proxy)

The proxy host.

String

proxyPort (proxy)

The proxy port.

Integer

accessToken (security)

The access token granted by a merchant to another in order to process transactions on their behalf. Used in place of environment, merchant id, public key and private key fields.

String

privateKey (security)

The private key provided by Braintree.

String

publicKey (security)

The public key provided by Braintree.

String

API Parameters (14 APIs)

The @Braintree endpoint is an API based component and has additional parameters based on which API name and API method is used. The API name and API method is located in the endpoint URI as the apiName/methodName path parameters:

braintree:apiName/methodName

There are 14 API names as listed in the table below:

API Name Type Description

address

Producer

Provides methods to create, delete, find, and update Address objects

clientToken

Producer

Generates client tokens, which are used to authenticate requests made directly on behalf of merchants This class does not need to be instantiated directly

creditCardVerification

Producer

To verify credit card information

customer

Producer

Provides methods to create, delete, find, and update Customer objects

dispute

Producer

Provides methods to interact with Dispute objects

documentUpload

Producer

API to upload evidence documents

merchantAccount

Producer

Provides methods to create, find, and update MerchantAccount objects

paymentMethod

Producer

Provides methods to interact with payments

paymentMethodNonce

Producer

Provides methods to interact with nonce payments

report

Producer

Provides methods to interact with reports

settlementBatchSummary

Producer

Provides methods to interact wit settlement summaries

subscription

Producer

Provides methods to interact with Subscriptions

transaction

Producer

Provides methods to interact with Transactions

webhookNotification

Producer

To retrieve notifications via webhooks

Each API is documented in the following sections to come.

API: address

Only producer is supported

The address API is defined in the syntax as follows:

braintree:address/methodName?[parameters]

The 4 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

create

Creates an Address for a Customer

delete

Deletes a Customer’s Address

find

Finds a Customer’s Address

update

Updates a Customer’s Address

Method create

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Address> create(String customerId, com.braintreegateway.AddressRequest request);

The braintree/create API method has the parameters listed in the table below:

Parameter Description Type

customerId

The id of the Customer

String

request

The request object

AddressRequest

Method delete

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Address> delete(String customerId, String id);

The braintree/delete API method has the parameters listed in the table below:

Parameter Description Type

customerId

The id of the Customer

String

id

The id of the Address to delete

String

Method find

Signatures:

  • com.braintreegateway.Address find(String customerId, String id);

The braintree/find API method has the parameters listed in the table below:

Parameter Description Type

customerId

The id of the Customer

String

id

The id of the Address

String

Method update

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Address> update(String customerId, String id, com.braintreegateway.AddressRequest request);

The braintree/update API method has the parameters listed in the table below:

Parameter Description Type

customerId

The id of the Customer

String

id

The id of the Address

String

request

The request object containing the AddressRequest parameters

AddressRequest

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: clientToken

Only producer is supported

The clientToken API is defined in the syntax as follows:

braintree:clientToken/methodName?[parameters]

The 1 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

generate

Method generate

Signatures:

  • String generate();

  • String generate(com.braintreegateway.ClientTokenRequest request);

The braintree/generate API method has the parameters listed in the table below:

Parameter Description Type

request

ClientTokenRequest

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: creditCardVerification

Only producer is supported

The creditCardVerification API is defined in the syntax as follows:

braintree:creditCardVerification/methodName?[parameters]

The 3 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

create

find

search

Method create

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.CreditCardVerification> create(com.braintreegateway.CreditCardVerificationRequest request);

The braintree/create API method has the parameters listed in the table below:

Parameter Description Type

request

CreditCardVerificationRequest

Method find

Signatures:

  • com.braintreegateway.CreditCardVerification find(String id);

The braintree/find API method has the parameters listed in the table below:

Parameter Description Type

id

String

Signatures:

  • com.braintreegateway.ResourceCollection<com.braintreegateway.CreditCardVerification> search(com.braintreegateway.CreditCardVerificationSearchRequest query);

The braintree/search API method has the parameters listed in the table below:

Parameter Description Type

query

CreditCardVerificationSearchRequest

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: customer

Only producer is supported

The customer API is defined in the syntax as follows:

braintree:customer/methodName?[parameters]

The 5 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

create

Creates a Customer

delete

Deletes a Customer by id

find

Finds a Customer by id

search

Finds all Transactions that match the query and returns a ResourceCollection

update

Updates a Customer

Method create

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Customer> create(com.braintreegateway.CustomerRequest request);

The braintree/create API method has the parameters listed in the table below:

Parameter Description Type

request

The request

CustomerRequest

Method delete

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Customer> delete(String id);

The braintree/delete API method has the parameters listed in the table below:

Parameter Description Type

id

The id of the Customer

String

Method find

Signatures:

  • com.braintreegateway.Customer find(String id);

  • com.braintreegateway.Customer find(String id, String associationFilterId);

The braintree/find API method has the parameters listed in the table below:

Parameter Description Type

associationFilterId

The id of the association filter to use

String

id

The id of the Customer

String

Signatures:

  • com.braintreegateway.ResourceCollection<com.braintreegateway.Customer> search(com.braintreegateway.CustomerSearchRequest query);

The braintree/search API method has the parameters listed in the table below:

Parameter Description Type

query

The request query to use for search

CustomerSearchRequest

Method update

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Customer> update(String id, com.braintreegateway.CustomerRequest request);

The braintree/update API method has the parameters listed in the table below:

Parameter Description Type

id

The id of the Customer

String

request

The request

CustomerRequest

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: dispute

Only producer is supported

The dispute API is defined in the syntax as follows:

braintree:dispute/methodName?[parameters]

The 7 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

accept

Accept a Dispute, given a dispute ID

addFileEvidence

Add File Evidence to a Dispute, given an ID and a FileEvidenceRequest File evidence request

addTextEvidence

Add Text Evidence to a Dispute, given an ID and content

finalize

Finalize a Dispute, given an ID

find

Returns a Dispute, given an ID

removeEvidence

Remove Evidence from a Dispute, given an ID and a DisputeEvidence ID

search

Finds all Disputes that match the query

Method accept

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Dispute> accept(String id);

The braintree/accept API method has the parameters listed in the table below:

Parameter Description Type

id

The dispute id to accept

String

Method addFileEvidence

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.DisputeEvidence> addFileEvidence(String disputeId, String documentId);

  • com.braintreegateway.Result<com.braintreegateway.DisputeEvidence> addFileEvidence(String disputeId, com.braintreegateway.FileEvidenceRequest fileEvidenceRequest);

The braintree/addFileEvidence API method has the parameters listed in the table below:

Parameter Description Type

disputeId

The dispute id to add text evidence to

String

documentId

The document id of a previously uploaded document

String

fileEvidenceRequest

The file evidence request for the dispute

FileEvidenceRequest

Method addTextEvidence

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.DisputeEvidence> addTextEvidence(String id, String content);

  • com.braintreegateway.Result<com.braintreegateway.DisputeEvidence> addTextEvidence(String id, com.braintreegateway.TextEvidenceRequest textEvidenceRequest);

The braintree/addTextEvidence API method has the parameters listed in the table below:

Parameter Description Type

content

The content of the text evidence for the dispute

String

id

The dispute id to add text evidence to

String

textEvidenceRequest

The text evidence request for the dispute

TextEvidenceRequest

Method finalize

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Dispute> finalize(String id);

The braintree/finalize API method has the parameters listed in the table below:

Parameter Description Type

id

The dispute id to finalize

String

Method find

Signatures:

  • com.braintreegateway.Dispute find(String id);

The braintree/find API method has the parameters listed in the table below:

Parameter Description Type

id

The dispute id to find

String

Method removeEvidence

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Dispute> removeEvidence(String disputeId, String evidenceId);

The braintree/removeEvidence API method has the parameters listed in the table below:

Parameter Description Type

disputeId

The dispute id to remove evidence from

String

evidenceId

The evidence id to remove

String

Signatures:

  • com.braintreegateway.PaginatedCollection<com.braintreegateway.Dispute> search(com.braintreegateway.DisputeSearchRequest query);

The braintree/search API method has the parameters listed in the table below:

Parameter Description Type

query

The query for what disputes to find

DisputeSearchRequest

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: documentUpload

Only producer is supported

The documentUpload API is defined in the syntax as follows:

braintree:documentUpload/methodName?[parameters]

The 1 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

create

Method create

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.DocumentUpload> create(com.braintreegateway.DocumentUploadRequest request);

The braintree/create API method has the parameters listed in the table below:

Parameter Description Type

request

DocumentUploadRequest

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: merchantAccount

Only producer is supported

The merchantAccount API is defined in the syntax as follows:

braintree:merchantAccount/methodName?[parameters]

The 5 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method create

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.MerchantAccount> create(com.braintreegateway.MerchantAccountRequest request);

The braintree/create API method has the parameters listed in the table below:

Parameter Description Type

request

MerchantAccountRequest

Method createForCurrency

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.MerchantAccount> createForCurrency(com.braintreegateway.MerchantAccountCreateForCurrencyRequest request);

The braintree/createForCurrency API method has the parameters listed in the table below:

Parameter Description Type

currencyRequest

MerchantAccountCreateForCurrencyRequest

Method fetchMerchantAccounts

Signatures:

  • com.braintreegateway.PaginatedResult<com.braintreegateway.MerchantAccount> fetchMerchantAccounts(int page);

The braintree/fetchMerchantAccounts API method has the parameters listed in the table below:

Parameter Description Type

page

Integer

Method find

Signatures:

  • com.braintreegateway.MerchantAccount find(String id);

The braintree/find API method has the parameters listed in the table below:

Parameter Description Type

id

String

Method update

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.MerchantAccount> update(String id, com.braintreegateway.MerchantAccountRequest request);

The braintree/update API method has the parameters listed in the table below:

Parameter Description Type

id

String

request

MerchantAccountRequest

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: paymentMethod

Only producer is supported

The paymentMethod API is defined in the syntax as follows:

braintree:paymentMethod/methodName?[parameters]

The 6 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

create

delete

find

grant

revoke

update

Method create

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.? extends PaymentMethod> create(com.braintreegateway.PaymentMethodRequest request);

The braintree/create API method has the parameters listed in the table below:

Parameter Description Type

request

PaymentMethodRequest

Method delete

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.? extends PaymentMethod> delete(String token);

  • com.braintreegateway.Result<com.braintreegateway.? extends PaymentMethod> delete(String token, com.braintreegateway.PaymentMethodDeleteRequest request);

The braintree/delete API method has the parameters listed in the table below:

Parameter Description Type

deleteRequest

PaymentMethodDeleteRequest

token

String

Method find

Signatures:

  • com.braintreegateway.PaymentMethod find(String token);

The braintree/find API method has the parameters listed in the table below:

Parameter Description Type

token

String

Method grant

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.PaymentMethodNonce> grant(String token);

  • com.braintreegateway.Result<com.braintreegateway.PaymentMethodNonce> grant(String token, com.braintreegateway.PaymentMethodGrantRequest grantRequest);

The braintree/grant API method has the parameters listed in the table below:

Parameter Description Type

grantRequest

PaymentMethodGrantRequest

token

String

Method revoke

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.? extends PaymentMethod> revoke(String token);

The braintree/revoke API method has the parameters listed in the table below:

Parameter Description Type

token

String

Method update

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.? extends PaymentMethod> update(String token, com.braintreegateway.PaymentMethodRequest request);

The braintree/update API method has the parameters listed in the table below:

Parameter Description Type

request

PaymentMethodRequest

token

String

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: paymentMethodNonce

Only producer is supported

The paymentMethodNonce API is defined in the syntax as follows:

braintree:paymentMethodNonce/methodName?[parameters]

The 2 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

create

find

Method create

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.PaymentMethodNonce> create(String paymentMethodToken);

  • com.braintreegateway.Result<com.braintreegateway.PaymentMethodNonce> create(com.braintreegateway.PaymentMethodNonceRequest request);

The braintree/create API method has the parameters listed in the table below:

Parameter Description Type

paymentMethodToken

String

request

PaymentMethodNonceRequest

Method find

Signatures:

  • com.braintreegateway.PaymentMethodNonce find(String paymentMethodNonce);

The braintree/find API method has the parameters listed in the table below:

Parameter Description Type

paymentMethodNonce

String

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: report

Only producer is supported

The report API is defined in the syntax as follows:

braintree:report/methodName?[parameters]

The 1 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

transactionLevelFees

Retrieves a Transaction-Level Fee Report

Method transactionLevelFees

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.TransactionLevelFeeReport> transactionLevelFees(com.braintreegateway.TransactionLevelFeeReportRequest request);

The braintree/transactionLevelFees API method has the parameters listed in the table below:

Parameter Description Type

request

The request

TransactionLevelFeeReportRequest

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: settlementBatchSummary

Only producer is supported

The settlementBatchSummary API is defined in the syntax as follows:

braintree:settlementBatchSummary/methodName?[parameters]

The 1 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

generate

Method generate

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.SettlementBatchSummary> generate(java.util.Calendar settlementDate);

  • com.braintreegateway.Result<com.braintreegateway.SettlementBatchSummary> generate(java.util.Calendar settlementDate, String groupByCustomField);

The braintree/generate API method has the parameters listed in the table below:

Parameter Description Type

groupByCustomField

String

settlementDate

Calendar

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: subscription

Only producer is supported

The subscription API is defined in the syntax as follows:

braintree:subscription/methodName?[parameters]

The 7 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

cancel

Cancels the Subscription with the given id

create

Creates a Subscription

delete

find

Finds a Subscription by id

retryCharge

search

Search for a Subscription

update

Updates a Subscription

Method cancel

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Subscription> cancel(String id);

The braintree/cancel API method has the parameters listed in the table below:

Parameter Description Type

id

Of the Subscription to cancel

String

Method create

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Subscription> create(com.braintreegateway.SubscriptionRequest request);

The braintree/create API method has the parameters listed in the table below:

Parameter Description Type

request

The request

SubscriptionRequest

Method delete

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Subscription> delete(String customerId, String id);

The braintree/delete API method has the parameters listed in the table below:

Parameter Description Type

customerId

String

id

String

Method find

Signatures:

  • com.braintreegateway.Subscription find(String id);

The braintree/find API method has the parameters listed in the table below:

Parameter Description Type

id

The id of the Subscription

String

Method retryCharge

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> retryCharge(String subscriptionId);

  • com.braintreegateway.Result<com.braintreegateway.Transaction> retryCharge(String subscriptionId, Boolean submitForSettlement);

  • com.braintreegateway.Result<com.braintreegateway.Transaction> retryCharge(String subscriptionId, java.math.BigDecimal amount);

  • com.braintreegateway.Result<com.braintreegateway.Transaction> retryCharge(String subscriptionId, java.math.BigDecimal amount, Boolean submitForSettlement);

The braintree/retryCharge API method has the parameters listed in the table below:

Parameter Description Type

amount

BigDecimal

submitForSettlement

Boolean

subscriptionId

String

Signatures:

  • com.braintreegateway.ResourceCollection<com.braintreegateway.Subscription> search(com.braintreegateway.SubscriptionSearchRequest searchRequest);

The braintree/search API method has the parameters listed in the table below:

Parameter Description Type

searchRequest

The SubscriptionSearchRequest

SubscriptionSearchRequest

Method update

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Subscription> update(String id, com.braintreegateway.SubscriptionRequest request);

The braintree/update API method has the parameters listed in the table below:

Parameter Description Type

id

The id of the Subscription

String

request

The request

SubscriptionRequest

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: transaction

Only producer is supported

The transaction API is defined in the syntax as follows:

braintree:transaction/methodName?[parameters]

The 14 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method Alias Description

adjustAuthorization

Submits the transaction with the given id to be adjusted for the given amount which must be less than or equal to the authorization amount

cancelRelease

Cancels a pending release of a transaction with the given id from escrow

cloneTransaction

credit

Creates a credit Transaction

find

Finds a Transaction by id

holdInEscrow

Holds the transaction with the given id for escrow

refund

Refunds all or part of a previous sale Transaction

releaseFromEscrow

Submits the transaction with the given id for release

sale

Creates a sale Transaction

search

Finds all Transactions that match the query and returns a ResourceCollection

submitForPartialSettlement

Submits a partial settlement transaction for the given id

submitForSettlement

Submits the transaction with the given id to be settled along with a TransactionRequest object

updateDetails

Updates details for a transaction that has been submitted for settlement

voidTransaction

Voids the transaction with the given id

Method adjustAuthorization

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> adjustAuthorization(String id, com.braintreegateway.TransactionRequest request);

  • com.braintreegateway.Result<com.braintreegateway.Transaction> adjustAuthorization(String id, java.math.BigDecimal amount);

The braintree/adjustAuthorization API method has the parameters listed in the table below:

Parameter Description Type

amount

To be adjusted

BigDecimal

id

Of the transaction to to be adjusted

String

request

Is the TransactionRequest object with amount details

TransactionRequest

Method cancelRelease

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> cancelRelease(String id);

The braintree/cancelRelease API method has the parameters listed in the table below:

Parameter Description Type

id

Of the transaction to cancel release from escrow of

String

Method cloneTransaction

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> cloneTransaction(String id, com.braintreegateway.TransactionCloneRequest request);

The braintree/cloneTransaction API method has the parameters listed in the table below:

Parameter Description Type

cloneRequest

TransactionCloneRequest

id

String

Method credit

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> credit(com.braintreegateway.TransactionRequest request);

The braintree/credit API method has the parameters listed in the table below:

Parameter Description Type

request

The request

TransactionRequest

Method find

Signatures:

  • com.braintreegateway.Transaction find(String id);

The braintree/find API method has the parameters listed in the table below:

Parameter Description Type

id

The id of the Transaction

String

Method holdInEscrow

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> holdInEscrow(String id);

The braintree/holdInEscrow API method has the parameters listed in the table below:

Parameter Description Type

id

Of the transaction to hold for escrow

String

Method refund

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> refund(String id);

  • com.braintreegateway.Result<com.braintreegateway.Transaction> refund(String id, com.braintreegateway.TransactionRefundRequest request);

  • com.braintreegateway.Result<com.braintreegateway.Transaction> refund(String id, java.math.BigDecimal amount);

The braintree/refund API method has the parameters listed in the table below:

Parameter Description Type

amount

BigDecimal

id

String

refundRequest

TransactionRefundRequest

Method releaseFromEscrow

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> releaseFromEscrow(String id);

The braintree/releaseFromEscrow API method has the parameters listed in the table below:

Parameter Description Type

id

Of the transaction to submit for release

String

Method sale

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> sale(com.braintreegateway.TransactionRequest request);

The braintree/sale API method has the parameters listed in the table below:

Parameter Description Type

request

The request

TransactionRequest

Signatures:

  • com.braintreegateway.ResourceCollection<com.braintreegateway.Transaction> search(com.braintreegateway.TransactionSearchRequest query);

The braintree/search API method has the parameters listed in the table below:

Parameter Description Type

query

The search query

TransactionSearchRequest

Method submitForPartialSettlement

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> submitForPartialSettlement(String id, com.braintreegateway.TransactionRequest request);

  • com.braintreegateway.Result<com.braintreegateway.Transaction> submitForPartialSettlement(String id, java.math.BigDecimal amount);

The braintree/submitForPartialSettlement API method has the parameters listed in the table below:

Parameter Description Type

amount

Of the partial settlement

BigDecimal

id

Of the transaction to add the partial settlement transaction for

String

request

The request

TransactionRequest

Method submitForSettlement

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> submitForSettlement(String id);

  • com.braintreegateway.Result<com.braintreegateway.Transaction> submitForSettlement(String id, com.braintreegateway.TransactionRequest request);

  • com.braintreegateway.Result<com.braintreegateway.Transaction> submitForSettlement(String id, java.math.BigDecimal amount);

The braintree/submitForSettlement API method has the parameters listed in the table below:

Parameter Description Type

amount

To settle. must be less than or equal to the authorization amount.

BigDecimal

id

Of the transaction to submit for settlement

String

request

The request

TransactionRequest

Method updateDetails

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> updateDetails(String id, com.braintreegateway.TransactionRequest request);

The braintree/updateDetails API method has the parameters listed in the table below:

Parameter Description Type

id

Of the transaction to update the details for

String

request

The request

TransactionRequest

Method voidTransaction

Signatures:

  • com.braintreegateway.Result<com.braintreegateway.Transaction> voidTransaction(String id);

The braintree/voidTransaction API method has the parameters listed in the table below:

Parameter Description Type

id

Of the transaction to void

String

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

API: webhookNotification

Only producer is supported

The webhookNotification API is defined in the syntax as follows:

braintree:webhookNotification/methodName?[parameters]

The 3 method(s) is listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)

Method parse

Signatures:

  • com.braintreegateway.WebhookNotification parse(String signature, String payload);

The braintree/parse API method has the parameters listed in the table below:

Parameter Description Type

payload

String

signature

String

Method parseWithoutSignatureVerification

Signatures:

  • com.braintreegateway.WebhookNotification parseWithoutSignatureVerification(String payload);

The braintree/parseWithoutSignatureVerification API method has the parameters listed in the table below:

Parameter Description Type

payload

String

Method verify

Signatures:

  • String verify(String challenge);

The braintree/verify API method has the parameters listed in the table below:

Parameter Description Type

challenge

String

In addition to the parameters above, the braintree API can also use any of the Query Parameters (13 parameters).

Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBraintree.parameter. The inBody parameter overrides message header, i.e. the endpoint parameter inBody=myParameterNameHere would override a CamelBraintree.myParameterNameHere header.

Examples

OSGi Blueprint

<?xml version="1.0"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
           xsi:schemaLocation="
             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
             http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
             http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">


    <cm:property-placeholder id="placeholder" persistent-id="camel.braintree">
    </cm:property-placeholder>

    <bean id="braintree" class="org.apache.camel.component.braintree.BraintreeComponent">
        <property name="configuration">
            <bean class="org.apache.camel.component.braintree.BraintreeConfiguration">
                <property name="environment" value="${environment}"/>
                <property name="merchantId" value="${merchantId}"/>
                <property name="publicKey" value="${publicKey}"/>
                <property name="privateKey" value="${privateKey}"/>
            </bean>
        </property>
    </bean>

    <camelContext trace="true" xmlns="http://camel.apache.org/schema/blueprint" id="braintree-example-context">
        <route id="braintree-example-route">
            <from uri="direct:generateClientToken"/>
            <to uri="braintree://clientToken/generate"/>
            <to uri="stream:out"/>
        </route>
    </camelContext>

</blueprint>

More Information

For more information on the endpoints and options see Braintree references at https://developers.braintreepayments.com/reference/overview

Spring Boot Auto-Configuration

When using braintree with Spring Boot make sure to use the following Maven dependency to have support for auto configuration:

<dependency>
  <groupId>org.apache.camel.springboot</groupId>
  <artifactId>camel-braintree-starter</artifactId>
  <version>x.x.x</version>
  <!-- use the same version as your Camel core version -->
</dependency>

The component supports 4 options, which are listed below.

Name Description Default Type

camel.component.braintree.autowired-enabled

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

Boolean

camel.component.braintree.configuration

Component configuration. The option is a org.apache.camel.component.braintree.BraintreeConfiguration type.

BraintreeConfiguration

camel.component.braintree.enabled

Whether to enable auto configuration of the braintree component. This is enabled by default.

Boolean

camel.component.braintree.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean