Webhooks
Testing
Sample payload and signature
We've provided a sampleNotification method to generate a parsable
signature and payload. This allows you to generate a sample notification and POST the contents of
the payload and signature to your application to test your webhook handling code.
- Callback
sampleNotification = gateway.webhookTesting.sampleNotification(
braintree.WebhookNotification.Kind.SubscriptionWentPastDue,
"myId"
);
gateway.webhookNotification.parse(
sampleNotification.bt_signature,
sampleNotification.bt_payload,
(err, webhookNotification) => {
webhookNotification.subscription.id // "myId"
}
);
- Promise
sampleNotification = gateway.webhookTesting.sampleNotification(
braintree.WebhookNotification.Kind.SubscriptionWentPastDue,
"myId"
);
gateway.webhookNotification.parse(
sampleNotification.bt_signature,
sampleNotification.bt_payload,
).then(webhookNotification => {
webhookNotification.subscription.id // "myId"
});
Note
The notification returned will contain a dummy object of the type specified, but this object is
not a complete item from your gateway. It will not necessarily have everything you expect from a
production webhook.
Braintree Auth
Trigger a test notification from Braintree
Once you've created a webhook, you can use the Control Panel to fire a test notification to the
webhook's destination URL. This notification's kind is
{{lookup viewModel.prefix serverSdk.name}}
- Log into the Control Panel
- Click on the gear icon in the top right corner
- Click API from the drop-down menu
- Click on the Webhooks tab
- Click the Check URL link located to the right of the URL you'd like to check