Overview
TheEnvironment enum defines the available API environments for the Flutterwave Rave Java Library. It determines whether your application communicates with the staging (sandbox) or live (production) Flutterwave servers.
Enum Definition
Enum Values
Represents the staging/sandbox environment for testing and development.
- Base URL:
https://ravesandboxapi.flutterwave.com/ - Purpose: Testing and development without real transactions
- API Keys: Use test keys (FLWPUBK_TEST and FLWSECK_TEST)
- Transactions: No real money is charged
Represents the live/production environment for real transactions.
- Base URL:
https://api.ravepay.co/ - Purpose: Production use with real transactions
- API Keys: Use live keys (FLWPUBK and FLWSECK)
- Transactions: Real money is processed
Usage Example
Setting Staging Environment
Setting Live Environment
Conditional Environment Setup
The
Environment enum value set in RaveConstant.ENVIRONMENT is used by the Endpoints class to automatically select the correct base URL for all API requests.Environment Comparison
| Feature | STAGING | LIVE |
|---|---|---|
| Base URL | ravesandboxapi.flutterwave.com | api.ravepay.co |
| Real Transactions | No | Yes |
| API Keys | Test keys | Live keys |
| Use Case | Development & Testing | Production |
| Data Persistence | May be reset periodically | Permanent |
Best Practices
- Always start with STAGING when developing and testing new features
- Use environment variables to manage which environment is active
- Never mix environments - don’t use staging keys with live environment or vice versa
- Test thoroughly in STAGING before switching to LIVE
- Implement environment checks in your code to prevent accidental production charges during development
Related
- RaveConstant - Global configuration class
- Endpoints - API endpoint management that uses environment settings