Chargebee
Chargebee supports subscriptions, a hosted customer portal, and invoice previews. Use this page when you are already operating in the Chargebee ecosystem.
Configuration
<?php
return [
'bnomei.klub.provider.handler' => \Bnomei\Klub\Provider\ChargebeeProvider::class,
'bnomei.klub.providers.chargebee' => [
'api_key' => fn() => env('CHARGEBEE_API_KEY'),
'site' => fn() => env('CHARGEBEE_SITE'),
'webhook_auth' => fn() => env('CHARGEBEE_WEBHOOK_AUTH'),
'webhook_secret' => fn() => env('CHARGEBEE_WEBHOOK_SECRET'),
'field' => 'chargebee',
],
];
Environment variables:
CHARGEBEE_API_KEYCHARGEBEE_SITECHARGEBEE_WEBHOOK_AUTHorCHARGEBEE_WEBHOOK_SECRET
Optional provider keys:
checkoutfor hosted page payload overridesplansfor local plan definitionsfieldto override the provider user-data field name
Webhooks
Configure Chargebee webhooks to POST /klub/webhooks/chargebee and secure them with HTTP Basic auth.
Chargebee uses the Authorization header. Set CHARGEBEE_WEBHOOK_AUTH (or CHARGEBEE_WEBHOOK_SECRET) to the expected Basic credentials.
Webhook auth verification is enforced when one of those options is set.
Portal and invoices
- Portal: supported via Chargebee portal sessions.
- Invoice preview: supported via Chargebee invoices.
Plan data (local)
Chargebee uses local plans (providers.chargebee.plans or site plans YAML):
idshould be your Chargebee item price ID.unit_amountandcurrencyare recommended for consistent local catalog output.typeshould match your use case (recurringorone_time).
Gotchas
- Chargebee requires both
CHARGEBEE_SITEandCHARGEBEE_API_KEY. - Webhooks are authenticated via HTTP Basic; configure
webhook_authorwebhook_secret. - Portal sessions require a stored Chargebee customer ID.
See Purchases for flow details.