Overview
The Phoenix payment iframe communicates with your application through thewindow.postMessage API. This page explains the messages exchanged between your application and the Phoenix payment iframe.
Messages from Phoenix to Your Application
The Phoenix payment iframe will send messages to your application to indicate the status of different processes:Handling Messages
Your application should listen for these messages and take appropriate actions:Parameters from Your Application to Phoenix
Parameters are passed from your application to the Phoenix payment iframe via URL query string:Required Parameters
| Parameter | Description | Example |
|---|---|---|
address | The Ethereum wallet address where USDC will be sent | 0x742d35Cc6634C0532925a3b844Bc454e4438f44e |
amount | The amount in USD that the user wants to convert to USDC | 100 |
Optional Parameters
| Parameter | Description | Example |
|---|---|---|
theme | The UI theme to use. Can be either ‘light’ or ‘dark’ | dark |
Security Considerations
To ensure secure communication between your application and the Phoenix payment iframe:- Always verify the origin of incoming messages to prevent cross-site scripting attacks
- Use HTTPS for all communication
- Validate input parameters before passing them to the iframe
- Clean up event listeners when the payment process is complete to prevent memory leaks