| name | chargebee-webhooks |
| description | Receive and verify Chargebee webhooks. Use when setting up Chargebee webhook handlers, debugging Basic Auth verification, or handling subscription billing events.
|
| license | MIT |
| metadata | {"author":"hookdeck","version":"0.1.0","repository":"https://github.com/hookdeck/webhook-skills"} |
Chargebee Webhooks
When to Use This Skill
- Setting up Chargebee webhook handlers
- Debugging Basic Auth verification failures
- Understanding Chargebee event types and payloads
- Processing subscription billing events
Essential Code
Chargebee uses Basic Authentication for webhook verification. Here's how to implement it:
Express.js
app.post('/webhooks/chargebee', express.json(), (req, res) => {
const auth = req..;
(!auth || !auth.()) {
res.().();
}
encoded = auth.();
decoded = .(encoded, ).();
[username, password] = decoded.();
expectedUsername = process..;
expectedPassword = process..;
(username !== expectedUsername || password !== expectedPassword) {
res.().();
}
event = req.;
.(, event.);
(event.) {
:
:
:
;
:
:
;
}
res.().();
});