dcg

Braintree

payment.braintree

Protects against destructive Braintree/PayPal payment operations like deleting customers or cancelling subscriptions via API/SDK calls.

  • 6blocking rules
  • 3safe patterns
  • 3Critical
  • 3High
~/.config/dcg/config.toml
[packs]
enabled = ["payment.braintree"]

Evaluated when a command contains braintree, braintreegateway.com, braintree., gateway.customer., gateway.merchant_account., gateway.payment_method., gateway.subscription..

Blocking rules

Each rule ID is payment.braintree:<name>. Use it in allowlists and [policy.rules].

  1. braintree-customer-delete

    Critical

    braintree.Customer.delete permanently deletes a Braintree customer.

    Explanation
    Deleting a Braintree customer removes their payment methods, transaction history references, and vault records. This can break billing reconciliation and compliance audit trails. Subscriptions for this customer will also fail. Safer alternatives: - Archive customer in your application instead - Cancel subscriptions and remove payment methods first - braintree.Customer.find() to verify customer before deletion
  2. braintree-gateway-customer-delete

    Critical

    gateway.customer.delete permanently deletes a Braintree customer.

    Explanation
    Deleting a customer via gateway removes all their payment methods and vault data from Braintree. Associated subscriptions will fail to renew and transaction history loses customer context. Safer alternatives: - Mark customer inactive in your system instead - gateway.customer.find() to verify before deletion - Export customer data for compliance before deletion
  3. braintree-merchant-account-delete

    Critical

    gateway.merchant_account.delete removes a Braintree merchant account.

    Explanation
    Deleting a merchant account stops payment processing for that account. Any sub-merchants or payment flows using this account will fail. Pending settlements may be affected, impacting cash flow. Safer alternatives: - Contact Braintree support for proper account closure - Verify no active transactions are pending - Transfer sub-merchants to another account first
  4. braintree-api-delete

    High

    Braintree API DELETE calls remove payment resources (customers, webhooks, etc.).

    Explanation
    Direct API DELETE calls to Braintree permanently remove payment resources without SDK safety checks. This can delete customers, payment methods, or webhook configurations with no confirmation. Safer alternatives: - Use Braintree SDK which may provide additional validation - GET the resource first to verify ID is correct - Test in sandbox environment before production
  5. braintree-payment-method-delete

    High

    gateway.payment_method.delete removes a stored payment method.

    Explanation
    Deleting a payment method removes the card or bank account from the vault. Subscriptions using this payment method will fail on next renewal. Customers will need to re-enter payment details to continue service. Safer alternatives: - Update subscription to use a different payment method first - gateway.payment_method.find() to verify before deletion - Notify customer before removing their payment method
  6. braintree-subscription-cancel

    High

    gateway.subscription.cancel cancels a subscription, impacting billing.

    Explanation
    Cancelling a subscription immediately stops recurring billing. The customer loses access at the end of their current period (or immediately, depending on configuration). This may require manual intervention to restore. Safer alternatives: - gateway.subscription.find() to verify subscription details first - Consider pausing or updating instead of cancelling - Communicate cancellation to customer before processing

Safe patterns

Checked first. A command that matches one is never blocked by this pack.

  • braintree-customer-find
  • braintree-customer-search
  • braintree-api-get