Overview
BoxBilling supports multiple payment providers through a pluggable adapter pattern. Each provider implements the same interface for checkout session creation, webhook verification, and payment status parsing.Supported providers
| Provider | Code | Checkout | Webhooks |
|---|---|---|---|
| Stripe | stripe | Stripe Checkout Sessions | Stripe-Signature header |
| Adyen | adyen | Adyen Sessions API | HMAC-SHA256 |
| GoCardless | gocardless | GoCardless flow | Webhook-Signature header |
| UCP | ucp | Universal Commerce Protocol | X-UCP-Signature header |
| Manual | manual | No checkout URL | HMAC-SHA256 |
Payment lifecycle
Creating a checkout session
To collect payment for an invoice, create a checkout session:checkout_url to complete payment.
Webhook handling
Payment providers send webhook notifications to update payment status. Configure the webhook URL per provider:- Verifies the webhook signature using the provider’s secret
- Parses the event payload
- Updates the payment status
- Updates the linked invoice status
- Sends BoxBilling webhooks (
payment.succeeded,payment.failed)
Provider-specific configuration
- Stripe
- Adyen
- GoCardless
- UCP
Set in your environment:Webhook events handled:
checkout.session.completed→succeededpayment_intent.succeeded→succeededpayment_intent.payment_failed→failedcheckout.session.expired→canceled
Manual payments
For offline payments (bank transfers, checks, etc.), mark a payment as paid directly:succeeded, records an invoice settlement, and marks the invoice as paid.
Refunds
succeeded payments can be refunded. The payment status changes to refunded.
Payment requests & dunning
Payment requests group multiple overdue invoices for a customer and drive the dunning campaign process.Dunning campaigns
Dunning campaigns automate payment recovery:- The
check_dunningtask finds overdue invoices above the campaign threshold - Groups invoices by customer and currency
- Creates a
PaymentRequestwith the total amount - The
process_payment_requeststask processes eligible requests - On success, linked invoices are marked as paid
- On failure, the system retries based on
max_attemptsanddays_between_attempts
Webhooks
| Event | Trigger |
|---|---|
payment.created | Payment record created |
payment.succeeded | Payment completed |
payment.failed | Payment failed |
payment_request.created | Dunning payment request created |
payment_request.payment_succeeded | Dunning payment succeeded |
payment_request.payment_failed | Dunning payment failed |
API endpoints
| Method | Path | Description |
|---|---|---|
GET | /v1/payments | List payments |
GET | /v1/payments/{id} | Get payment details |
POST | /v1/payments/checkout | Create checkout session |
POST | /v1/payments/webhook/{provider} | Handle provider webhook |
POST | /v1/payments/{id}/mark-paid | Mark as paid (manual) |
POST | /v1/payments/{id}/refund | Refund a payment |
DELETE | /v1/payments/{id} | Delete a pending payment |
GET | /v1/payment_requests | List payment requests |
POST | /v1/payment_requests | Create payment request |