Straddle provides two distinct environments for developers: a sandbox environment for testing and a production environment for live transactions. This guide will help you understand the differences between these environments and how to use them effectively in your development process.

Overview

Straddle offers two environments:

  1. Sandbox Environment: https://test.straddle.io
  2. Production Environment: https://api.straddle.io

Each environment serves a specific purpose in your development lifecycle.

Sandbox Environment

The sandbox environment (https://test.straddle.io) is designed for testing and development purposes. It allows you to integrate and experiment with Straddle’s API without affecting real data or triggering actual financial transactions.

Key Features of the Sandbox Environment

  • Simulates the behavior of the production environment
  • Uses test API keys (prefixed with sk_test_)
  • Does not process real financial transactions
  • Provides pre-defined test data and scenarios
  • No rate limits or usage restrictions

When to Use the Sandbox Environment

Use the sandbox environment when:

  • Developing and testing your integration
  • Experimenting with new features
  • Running automated tests
  • Demonstrating your application without using real data

Accessing the Sandbox Environment

To use the sandbox environment, make API requests to https://test.straddle.io and use your test API key for authentication.

Example API request to the sandbox environment:

Production Environment

The production environment (https://api.straddle.io) is used for live, real-world transactions. This is where your application will interact with actual customer data and process real financial transactions.

Key Features of the Production Environment

  • Processes real financial transactions
  • Uses live API keys (prefixed with sk_live_)
  • Interacts with real customer data
  • Subject to rate limits and usage restrictions
  • Monitored for performance and reliability

When to Use the Production Environment

Use the production environment when:

  • Your application is ready for real-world use
  • Processing actual financial transactions
  • Working with real customer data

Accessing the Production Environment

To use the production environment, make API requests to https://api.straddle.io and use your live API key for authentication.

Example API request to the production environment:

Best Practices

To ensure a smooth transition from development to production, follow these best practices:

  1. Use environment variables: Store your API keys and environment URLs as environment variables to easily switch between sandbox and production.

  2. Thoroughly test in sandbox: Extensively test your integration in the sandbox environment before moving to production.

  3. Gradual rollout: When moving to production, consider a phased rollout to minimize potential issues.

  4. Monitor closely: Keep a close eye on your production transactions and be prepared to switch back to sandbox if issues arise.

  5. Keep environments separate: Never mix sandbox and production data or API keys.

Transitioning from Sandbox to Production

When you’re ready to go live with your Straddle integration, follow these steps:

  1. Review and test all features in the sandbox environment.
  2. Update your API key to the live production key.
  3. Change your API endpoint from https://test.straddle.io to https://api.straddle.io.
  4. Update any environment-specific configurations or settings.
  5. Perform final testing in production with real data (start with small, controlled transactions).
  6. Monitor your production transactions closely for any issues.

Always double-check that you’re using the correct environment and API key before processing real transactions. Using sandbox credentials in production can lead to failed transactions and poor user experience.

Conclusion

Understanding and properly utilizing Straddle’s sandbox and production environments is crucial for successful integration and deployment. By following the guidelines and best practices outlined in this guide, you can ensure a smooth development process and transition to production.

For more detailed information on specific API endpoints and how they behave in different environments, refer to our API Reference documentation.