Webhooks
Testing
Sample payload and signature
We've provided a sample_notification 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.
- Ruby
sample_notification = gateway.webhook_testing.sample_notification(
Braintree::WebhookNotification::Kind::SubscriptionWentPastDue,
"my_id"
)
webhook_notification = gateway.webhook_notification.parse(
sample_notification[:bt_signature],
sample_notification[:bt_payload]
)
webhook_notification.subscription.id
# => "my_id"
Braintree Auth
Sample payload and signature
We've provided a {{lookup viewModel.prefix serverSdk.name}}
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.
- 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
Be careful when using this check in production – if your webhook handling code doesn’t look for the
kind of
webhooks it receives, this could lead to unexpected behavior.
For example, if your integration
assumes it will only receive Subscription Canceled webhooks and you test the URL, it might
cause an exception when your code tries to access the non-existent subscription object on the
webhook.