Skip to main content

Braintree

The Braintree gateway supports card payments, PayPal via Braintree, and Venmo in markets where available. It is a separate package dependency — install braintree/braintree_php to use it.

Install the Braintree SDK

composer require braintree/braintree_php:"^6.32"

Configuration

// config/subscribd.php
'gateways' => [
    'braintree' => [
        'driver'      => \Pixelworxio\Subscribd\Gateways\BraintreeGateway::class,
        'environment' => env('BRAINTREE_ENV', 'production'),
        'merchant_id' => env('BRAINTREE_MERCHANT_ID'),
        'public_key'  => env('BRAINTREE_PUBLIC_KEY'),
        'private_key' => env('BRAINTREE_PRIVATE_KEY'),
    ],
],

Environment variables

BRAINTREE_ENV=production
BRAINTREE_MERCHANT_ID=...
BRAINTREE_PUBLIC_KEY=...
BRAINTREE_PRIVATE_KEY=...
Set BRAINTREE_ENV=sandbox for development and testing.

Webhooks

Register https://yourapp.com/subscribd/webhook/braintree as a webhook endpoint in the Braintree Control Panel. Enable:
  • subscription_charged_successfully
  • subscription_charged_unsuccessfully
  • subscription_canceled
  • subscription_expired
  • subscription_trial_ended
  • subscription_went_past_due
  • subscription_went_active

Limitations

  • interval_count must be 1. Braintree does not support billing cycles with interval_count > 1. Subscribd throws SubscriptionException if you attempt to create a subscription on a plan with interval_count > 1 using this gateway.
  • Trial extension is not supported natively. ExtendTrial updates the local trial_ends_at only.
  • Proration is handled by Subscribd’s built-in ProrationEngine.
  • Pausing is not supported natively. Subscribd updates the local status only; billing at Braintree continues until the subscription is canceled.

Next steps

  • Paddle — Merchant of Record gateway
  • Webhooks — Full webhook reference