Braintree
Unchained payment plugin for Braintree, a PayPal-owned payment processor that supports various payment methods including PayPal, credit cards, and digital wallets.
Not Included in Presets
This plugin is not included in the default plugin presets. You need to import it explicitly in your project.
Installation
import '@unchainedshop/plugins/payment/braintree';
Requires the braintree npm package as a peer dependency:
npm install braintree
Create Provider
mutation CreateBraintreeProvider {
createPaymentProvider(
paymentProvider: {
type: GENERIC
adapterKey: "shop.unchained.braintree-direct"
}
) {
_id
}
}
mutation ConfigureBraintreeProvider {
updatePaymentProvider(
paymentProviderId: "provider-id"
paymentProvider: {
configuration: [
{ key: "publicKey", value: "your-public-key" }
{ key: "merchantId", value: "your-merchant-id" }
]
}
) {
_id
}
}
Environment Variables
| Variable | Default | Description |
|---|---|---|
BRAINTREE_SANDBOX_TOKEN | - | Access token for sandbox environment (testing) |
BRAINTREE_PRIVATE_KEY | - | Private key for production environment |
Provider Configuration
| Key | Description |
|---|---|
publicKey | Your Braintree public key (required) |
merchantId | Your Braintree merchant ID (required) |
Environment Setup
Sandbox Mode (Testing):
- Set
BRAINTREE_SANDBOX_TOKENenvironment variable - The plugin will automatically use sandbox mode when this token is present
Production Mode:
- Remove
BRAINTREE_SANDBOX_TOKENor leave it empty - Configure
publicKey,merchantIdin the provider configuration - Set
BRAINTREE_PRIVATE_KEYenvironment variable