Overview
Auto top-up automatically adds credits to a customer’s wallet when the balance falls below a specified threshold. This ensures uninterrupted service and provides a seamless credit management experience.How Auto Top-Up Works
Configuration
Auto top-up is configured at the wallet level using theauto_topup object:
Configuration Fields
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | Yes | Whether auto top-up is active |
threshold | decimal | Yes | Balance level that triggers top-up (in credits) |
amount | decimal | Yes | Credits to add when triggered (in credits) |
invoicing | boolean | Yes | Whether to create an invoice for the top-up |
All amounts are in credit units, not currency units. Use the wallet’s
conversion_rate to convert between credits and currency.Setting Up Auto Top-Up
On Wallet Creation
Include auto top-up settings when creating a new wallet:On Existing Wallet
Update an existing wallet to enable auto top-up:Disable Auto Top-Up
Setenabled to false to disable without removing configuration:
Top-Up Behavior
Trigger Conditions
Auto top-up is evaluated:- After credit transactions - When credits are added to the wallet
- After debit transactions - When credits are consumed
- After wallet balance calculations - Real-time balance updates
Threshold Evaluation
Top-up triggers when:credit_balance < threshold
Example:
| Current Balance | Action |
|---|---|
| 75.00 | No action (above threshold) |
| 50.00 | No action (equal to threshold) |
| 49.99 | Top up 200.00 credits |
| 10.00 | Top up 200.00 credits |
The top-up amount is fixed - it doesn’t calculate to reach a target balance. If balance is 10 and amount is 200, the new balance will be 210.
Transaction Reason
Auto top-up transactions are recorded with: With invoicing:Invoicing Behavior
When invoicing: true
Payment required
Customer must pay the invoice to finalize credits. Until paid:
- Credits show as
PENDINGin transaction - Credits cannot be used for consumption
- Invoice appears in customer’s unpaid balance
When invoicing: false
Use
invoicing: false for promotional credits or when billing is handled externally. Use invoicing: true when customers should be charged for the top-up.Use Cases
Prepaid Service Plans
Promotional Credit Maintenance
Enterprise Credit Buffer
Development/Testing Credits
Monitoring Auto Top-Up
Check Auto Top-Up Status
Retrieve wallet with auto top-up configuration:Track Top-Up Transactions
Filter wallet transactions to see auto top-ups:Monitor Top-Up Invoices
Find invoices created by auto top-up:Best Practices
Threshold Sizing
Calculate average consumption
Determine typical daily or weekly credit usage:
- Low usage: 10-50 credits/day
- Medium usage: 50-500 credits/day
- High usage: 500+ credits/day
Set threshold for buffer
Configure threshold to provide 3-7 days of buffer:
- Low: threshold = 100-200 credits
- Medium: threshold = 500-1000 credits
- High: threshold = 2000-5000 credits
Prevent Over-Billing
- Set reasonable
amountvalues to avoid large unexpected charges - Use
thresholdhigh enough to prevent frequent top-ups - Monitor customers with frequent auto top-ups (may indicate usage spikes)
- Consider usage alerts in addition to auto top-up
Test Configuration
- Create a test wallet with auto top-up
- Manually debit credits to trigger threshold
- Verify credits are added
- If invoicing is enabled, check invoice creation
- Confirm transaction appears in wallet history
- Test disabling and re-enabling
Communication
- Notify customers when auto top-up is enabled on their account
- Send emails when auto top-up is triggered
- Include top-up transactions in billing summaries
- Allow customers to configure their own thresholds (via self-service portal)
Conversion Rate Considerations
Auto top-up uses the wallet’stopup_conversion_rate for invoicing:
If
topup_conversion_rate differs from conversion_rate, customers may pay a different rate for auto top-up credits versus credit consumption.Limitations
Cannot Customize Per Top-Up
- Amount is fixed in configuration
- Cannot vary based on balance or usage patterns
- No dynamic pricing or volume discounts
Single Threshold
- Only one threshold can be configured
- Cannot set multiple tiers (e.g., 50 credits at threshold 100, 200 credits at threshold 20)
No Scheduling
- Triggers based on balance only
- Cannot schedule regular top-ups (e.g., “every Monday”)
Security Considerations
Invoicing Enabled
- Customer must have valid payment method on file
- Failed payments will leave credits in
PENDINGstate - Consider payment retry policies
- Set invoice due dates appropriately
Invoicing Disabled
- No payment validation occurs
- Credits are granted immediately
- Monitor for abuse if exposed to self-service
- Consider rate limiting or maximum top-up amounts
Wallet Permissions
- Restrict who can enable/disable auto top-up
- Log configuration changes for audit
- Validate threshold and amount ranges (prevent $10,000 auto top-ups by accident)
Troubleshooting
Top-Up Not Triggering
Check balance calculation:credit_balance is actually below threshold.
Verify configuration:
auto_topup.enabled = true and values are correct.
Check recent transactions:
May have recently triggered - check for transactions with reason PURCHASED_CREDIT_INVOICED.
Credits Added But Not Available
Ifinvoicing: true, credits remain PENDING until invoice is paid:
Multiple Top-Ups in Short Period
If balance drops below threshold multiple times quickly:- Increase
amountto provide larger buffer - Increase
thresholdto trigger earlier - Investigate usage spike causing rapid consumption
Next Steps
Wallets
Learn about wallet configuration
Credit Grants
Set up automatic credit allocation
Alerts
Configure balance notifications
Invoices
Understand invoice creation