Docs / Stripe Integration
Stripe Integration
Connect Stripe for credit top-ups. Chargly handles checkout sessions and syncs purchases to wallet balances automatically.
MVP scope
Chargly currently supports Stripe-powered credit pack purchases and wallet sync for the core credit-first billing flow.
What this integration gives you
- Stripe-powered credit purchases
- Automatic wallet sync
- Clean top-up flow for users
Overview
Users buy credit packs through Stripe Checkout. When a purchase completes, Chargly receives the webhook, adds credits to the customer's wallet, and the balance updates in real time.
Prerequisites
- Stripe account
- Chargly app with Stripe connected in the dashboard
Credit packs
Define credit packs in the Chargly dashboard. Each pack has a code you use when creating checkout sessions.
Example mappings
Checkout flow
Create a checkout session for a customer. Redirect them to the returned URL. After payment, Stripe sends a webhook to Chargly; credits are added to the wallet.
Example: client-side redirect flow. Other integration patterns (e.g. server-side redirect, embedded components) are also valid.
const { checkoutUrl } = await chargly.createCheckout({
customerId: "user_123",
creditPackCode: "chargly_500"
})
// Redirect user to checkout
window.location.href = checkoutUrlWebhook confirmation
After successful payment:
- Stripe sends an event
- Chargly verifies the purchase
- Credits are added to the correct wallet
- The balance updates in real time
No setup required on your side — configure Stripe in the dashboard and Chargly handles credit sync.