***

title: "BraintreePluginOptions"
generated: true
---------------

<GenerationInfo sourceFile="packages/braintree-plugin/src/types.ts" sourceLine="25" packageName="@vendure-community/braintree-plugin" />

Options for the Braintree plugin.

```ts title="Signature"
interface BraintreePluginOptions {
    environment?: Environment;
    storeCustomersInBraintree?: boolean;
    extractMetadata?: (transaction: Transaction) => PaymentMetadata;
    merchantAccountIds?: BraintreeMerchantAccountIds;
}
```

<div className="members-wrapper">

### environment

\<MemberInfo kind="property" type={`Environment`} default={`Environment.Sandbox`}   />

The Braintree environment being targeted, e.g. sandbox or production.

### storeCustomersInBraintree

\<MemberInfo kind="property" type={`boolean`} default={`false`}   />

If set to `true`, a [Customer](https://developer.paypal.com/braintree/docs/guides/customers) object
will be created in Braintree, which allows the secure storage ("vaulting") of previously-used payment methods.
This is done by adding a custom field to the Customer entity to store the Braintree customer ID,
so switching this on will require a database migration / synchronization.

Since v1.8, it is possible to override vaulting on a per-payment basis by passing `includeCustomerId: false` to the
`generateBraintreeClientToken` mutation.

### extractMetadata

\<MemberInfo kind="property" type={`(transaction: Transaction) => PaymentMetadata`}  since="1.7.0"  />

Allows you to configure exactly what information from the Braintree
[Transaction object](https://developer.paypal.com/braintree/docs/reference/response/transaction#result-object) (which is returned by the
`transaction.sale()` method of the SDK) should be persisted to the resulting Payment entity metadata.

By default, the built-in extraction function will return a metadata object that looks like this:

*Example*

```ts
const metadata = {
  "status": "settling",
  "currencyIsoCode": "GBP",
  "merchantAccountId": "my_account_id",
  "cvvCheck": "Not Applicable",
  "avsPostCodeCheck": "Not Applicable",
  "avsStreetAddressCheck": "Not Applicable",
  "processorAuthorizationCode": null,
  "processorResponseText": "Approved",
  // for Paypal payments
  "paymentMethod": "paypal_account",
  "paypalData": {
    "payerEmail": "michael-buyer@paypalsandbox.com",
    "paymentId": "PAYID-MLCXYNI74301746XK8807043",
    "authorizationId": "3BU93594D85624939",
    "payerStatus": "VERIFIED",
    "sellerProtectionStatus": "ELIGIBLE",
    "transactionFeeAmount": "0.54"
  },
  // for credit card payments
  "paymentMethod": "credit_card",
  "cardData": {
    "cardType": "MasterCard",
    "last4": "5454",
    "expirationDate": "02/2023"
  }
  // publicly-available metadata that will be
  // readable from the Shop API
  "public": {
    "cardData": {
      "cardType": "MasterCard",
      "last4": "5454",
      "expirationDate": "02/2023"
    },
    "paypalData": {
      "authorizationId": "3BU93594D85624939",
    }
  }
}
```

### merchantAccountIds

\<MemberInfo kind="property" type={`BraintreeMerchantAccountIds`}   />

An optional mapping of currency codes to Braintree Merchant Account IDs.
When set, the corresponding Merchant Account ID will be used for transactions
in the given currency.

</div>
