OAuth
Availability
OAuth is in closed beta in production, and open beta in sandbox. Contact us to express interest in the production beta release.
Notification kinds
The notification kind, returned by calling kind on the notification object, reveals what triggered the webhook. The $webhookNotification->kind for OAuth webhooks will be one of the following:
BraintreeWebhookNotification::OAUTHACCESSREVOKED
The following table describes the conditions that trigger each kind of webhook.
| Notification Type | Description |
|---|---|
oauth_access_revocation | A connected merchant has revoked API access. |
Attributes
kindenumThe kind of webhook notification.
timestampdateThe UTC time at which the webhook was triggered.
merchantIdstringThe ID of the connected merchant.
oauthApplicationClientIdstringThe OAuth application client ID.
OAuth access revoked
Below is a full example of how to trigger a webhook when a connected merchant has revoked access to their account.
- PHP
$gateway = new BraintreeGateway([
'environment' => 'sandbox'
'merchantId' => 'use_your_merchant_id',
'publicKey' => 'use_your_public_key',
'privateKey' => 'use_your_private_key'
]);
$notification = $gateway->webhookNotification()->parse(
$btSignature,
$btPayload
);
$notification->kind;
// BraintreeWebhookNotification::OAUTH_ACCESS_REVOKED
$notification->oauthAccessRevocation->merchantId;
// "merchant_id"