Webhooks

Webhooks allow Braintree to push messages to your servers when you configure a webhook endpoint URL. If you support new Braintree account signups in your Braintree Auth integration, you can subscribe to webhooks that alert you to important events happening with the connected merchant's account.

We currently provide four webhooks for new Braintree merchant accounts created via Braintree Auth:

Before you get startedAnchorIcon

If you are not using webhooks already, follow the general webhooks guide to configure webhooks in your gateway.

Connected merchant underwriting statusAnchorIcon

This webhook notifies you when a connected merchant's underwriting status has changed or they have submitted an application:

  1. Python
gateway = braintree.BraintreeGateway(
    braintree.Configuration(
        environment=braintree.Environment.Sandbox
        merchant_id='use_your_merchant_id',
        public_key='use_your_public_key',
        private_key='use_your_private_key',
    )
)

notification = braintree.webhook_notification.parse(
    bt_signature,
    bt_payload
)

notification.kind
# braintree.WebhookNotification.Kind.ConnectedMerchantStatusTransitioned

notification.connected_merchant_status_transitioned.status
# "approved"

notification.connected_merchant_status_transitioned.merchant_id
# "merchant_id"

notification.connected_merchant_status_transitioned.oauth_application_client_id
# "oauth_application_client_id"

The following status transitions trigger a webhook:

StatusDescription
approved A merchant has been approved for a Braintree account. All funds from settled transctions will be disbursed to the merchant's bank account.
deniedA merchant has been denied. All settled transactions will be refunded.
application_submitted A merchant has submitted their application to Braintree. The merchant can now accept payments to a limit - 25 transactions or up to $2500. Funds will not be disbursed until the merchant is approved.
under_reviewA merchant application is being reviewed.
inactive A merchant decided to not move forward with the underwriting process. This also occurs if a trial merchant has not submitted an application within 30 days of processing their first payment.

PayPal account status changedAnchorIcon

This webhook notifies you when a connected merchant's PayPal account has been successfully linked or unlinked to their Braintree gateway.

  1. Python
gateway = braintree.BraintreeGateway(
    braintree.Configuration(
        environment=braintree.Environment.Sandbox
        merchant_id='use_your_merchant_id',
        public_key='use_your_public_key',
        private_key='use_your_private_key',
    )
)

notification = gateway.webhook_notification.parse(
    bt_signature,
    bt_payload
)

notification.kind
# braintree.WebhookNotification.Kind.ConnectedMerchantPayPalStatusChanged

notification.connected_merchant_paypal_status_changed.action
# "link"

notification.connected_merchant_paypal_status_changed.merchant_id
# "merchant_id"

notification.connected_merchant_paypal_status_changed.oauth_application_client_id
# "oauth_application_client_id"

The following linking actions trigger a webhook:

ActionDescription
link A connected merchant has connected a PayPal account to their gateway and can accept PayPal payments.
unlink A connected merchant has disconnected the PayPal account from their gateway. They can no longer accept PayPal payments until they link another PayPal account to their gateway.

DisputesAnchorIcon

This webhook notifies you when a connected merchant receives a dispute on a transaction.

  1. Python
gateway = braintree.BraintreeGateway(
    braintree.Configuration(
        environment=braintree.Environment.Sandbox
        merchant_id='use_your_merchant_id',
        public_key='use_your_public_key',
        private_key='use_your_private_key',
    )
)

notification = gateway.webhook_notification.parse(
    bt_signature,
    bt_payload
)

notification.kind
# braintree.WebhookNotification.Kind.DisputeOpened

notification.source_merchant_id
# "source_merchant_id"

notification.dispute.status
# braintree.Dispute.Status.Open

Refer to the Dispute webhooks reference for all of the available properties on dispute objects.

OAuth access revokedAnchorIcon

This webhook notifies you when the connected merchant has revoked access to their account.

  1. Python
gateway = braintree.BraintreeGateway(
    braintree.Configuration(
        environment=braintree.Environment.Sandbox
        merchant_id='use_your_merchant_id',
        public_key='use_your_public_key',
        private_key='use_your_private_key',
    )
)

notification = gateway.webhook_notification.parse(
    bt_signature,
    bt_payload
)

notification.kind
# braintree.WebhookNotification.Kind.OAuthAccessRevoked

notification.oauth_access_revocation.merchant_id
# "merchant_id"