A comprehensive guide to integrating and customizing the Straddle embed form in your React application
Install Dependencies
Add Component Files
StraddleEmbedComponent.tsx
file into your project’s component directory.Import and Use
production
, sandbox
).env
value is not injected into the URL, but is instead provided as a separate data attribute, making it accessible to the embedded form internally.
env
Propenv
prop allows you to indicate whether the embedded Straddle form should create a test account (in your platform’s sandbox environment) or a real, production-level account. This is particularly useful when you’re testing webhook integrations, trialing new features, or verifying payment flows before going live.env
is set to a value indicating a sandbox or test environment (e.g., env="sandbox"
), the embedded form will create new accounts in your sandbox environment. This ensures you can safely experiment, test your integrations, and verify webhook responses without impacting live data or existing real accounts.env
is set to production
, the embedded form operates against your real, production-level environment. Accounts created, data submitted, and webhooks triggered from this embedded form will reflect actual usage scenarios and should be treated as live, customer-facing transactions.env
value is not appended to the Straddle form URL. Instead, it’s passed as a data attribute on the iframe (i.e., env
), allowing the form itself (within the iframe) to interpret and act upon the environment setting. This ensures that the same URL can be used consistently, while the underlying logic—such as which database endpoints or webhook routes to invoke—is dynamically adjusted based on env
.
Recommended Usage:
env="sandbox"
whenever you’re testing new integrations, verifying that your webhook listeners work correctly, or experimenting with new features.env="production"
only when you’re ready for real-world usage, ensuring that account creations, messages, and webhooks are fully integrated into your live environment.dynamicHeight=1
URL parameter enables the embed to communicate its content height.Primary Script Loading
Fallback Mechanism
Error Recovery
Platform ID Management
platformId
is not secret, it is recommended to store it in environment variables or a secure configuration management system.Environment Value (env)
env
prop to indicate the deployment environment (such as production, staging, or sandbox) to the embedded form. The form can then read this value and adjust its behavior or display accordingly.Width Selection
Error Handling
Performance
flex justify-center w-full
to ensure proper centering and responsive behavior.Script Loading
Resource Management
Layout Stability
Script Loading
Platform ID & env
platformId
and env
values are correct and properly formatted. The env
prop should match the environment context you intend the form to operate within.Container Size
Network Connection