Limited Release
Test
Before going live, use your sandbox environment to thoroughly test the Usage-based Billing integration. Your testing should involve:1. Billing infrastructure setup
- Billing entities: Create and configure billing entities with tax settings.
- Taxes: Create, update, and delete tax configurations for different jurisdictions.
- Metrics: Create, update, and validate metrics with different aggregation types (
COUNT,SUM,MAX,COUNT_DISTINCT,LATEST) and metric types (METERED,RECURRING). - Features: Create features with different privilege types (
STRING,BOOLEAN,INTEGER,SELECT) and manage feature privileges. - Pricing plans: Create plans with various pricing models (
STANDARD,GRADUATED,PACKAGE,PERCENTAGE,VOLUME) and fee structures (subscription, usage-based, minimum commitments, usage thresholds). - Plan entitlements: Create, update, and delete plan-level entitlements and privileges.
- Customer management: Register customers, update details, delete customers, and test customer lifecycle.
- Subscriptions: Create subscriptions with different billing times (
CALENDAR,ANNIVERSARY), handle plan changes, test trial periods, and verify status transitions (PENDING,ACTIVE,TERMINATED,CANCELED).
2. Prepaid credits and wallets
- Wallet creation: Test manual credit management and automatic top-up configurations.
- Top-up strategies: Validate fixed amount and target balance methods with different triggers (schedule, threshold).
- Wallet scenarios:
- Partial balance (insufficient credits).
- Empty wallet (no credits).
- No wallet exists for customer.
- Wallet management: Add credits, remove credits, update configurations, and terminate wallets.
3. Usage recording and billing
- Event recording: Test single events and batch submissions.
- Event auditing: Retrieve and verify recorded usage events.
- Usage aggregation: Verify events are properly aggregated according to metrics.
- Current usage: Poll customer usage data during billing periods.
- Past usage: Retrieve historical usage data.
- Invoice generation: Generate invoices and validate charge calculations with different pricing models.
- Billing calculation: Test the complete payment priority system:
- Credit notes applied first.
- Prepaid credits deducted second.
- Payment method charged for remaining amount.
4. Payment processing and issues
- Payment priority testing: Create scenarios with different combinations of credit notes, prepaid credits, and payment methods.
- Payment failures: Test failed payment scenarios and retry functionality.
- Credit notes:
- Create credit notes with refund amounts only.
- Create credit notes with credit amounts only.
- Create credit notes with both refund and credit amounts.
- Test credit note wallet auto-creation.
- Void credit notes and validate status changes.
5. Monitoring and auditing
- Usage monitoring: Poll customer usage data and validate accuracy.
- Event auditing: Retrieve and verify recorded usage events.
- Credit note management: List, retrieve, and manage credit note details.
- Wallet monitoring: Track wallet balances and transaction history.
6. Webhooks and notifications
- Webhook setup: Configure and validate webhook endpoints.
- Event testing: Test webhook delivery for:
- Invoice events (generated, payment failed, payment completed).
- Wallet events (balance changes, top-ups, termination).
- Credit note events (created, applied, voided).
- Webhook reliability: Test retry mechanisms and failure handling.
7. Error handling and edge cases
- Invalid requests: Test with missing required fields, invalid data formats, and malformed requests.
- Business logic errors: Test scenarios like:
- Recording events for non-existent subscriptions.
- Creating credit notes for invalid invoices.
- Insufficient wallet balances.
- Duplicate transaction IDs.
- Rate limiting: Test API rate limits and error responses.
- Authentication: Test with invalid or expired access tokens.
8. End-to-end workflows
- Complete billing cycle: From usage recording to invoice payment.
- Customer lifecycle: From registration to subscription termination.
- Payment issue resolution: From failed payment to successful retry with credit notes.
- Prepaid credit flow: From wallet setup to credit consumption during billing.