Skip to main content
For non-React frameworks or custom implementations, follow this HTML integration guide.

Step 1: Obtain Access Token

Before integrating Phoenix, you need to obtain an access token from your backend.
See the Obtaining Access Token page for detailed instructions on setting up the backend endpoint.
This is example code for obtaining an access token. You will need to adapt the endpoint URL and request format based on your specific backend implementation. Refer to the Obtaining Access Token page for a complete example of setting up a backend service.

Step 2: Add the iframe to your HTML

Step 3: Add Essential CSS

Add this CSS to style the payment container and iframe:

Step 4: Add JavaScript for Communication

You need to add JavaScript functions to handle the integration. Here’s a breakdown of the required parameters and functions:

Required Parameters

  • walletAddress: The Ethereum wallet address where USDC will be sent
  • amount: The amount in USD to convert to USDC
  • accessToken: The access token from your backend
  • onClose: Function to handle when the user closes the payment modal
  • handlePaymentMessage: Function to process payment response messages
  • onDone: Function to handle when the payment process is complete (new)

Core Functions

Transaction Success Data

When a transaction is successful, the data object will contain:
  • amount: The USD amount
  • token: The token received (e.g., “USDC”)
  • chain: The blockchain (e.g., “Base”)
  • walletAddress: The receiving wallet address
  • sendAmount: The amount of tokens sent
  • transactionHash: The blockchain transaction hash
  • basescanLink: Link to view the transaction on Basescan

Order Created Data

When an order is created, the data object will contain:
  • order_id: Unique identifier for the order
  • data: Object containing additional order details:
    • created_at: Timestamp of order creation
    • buyer_address: The buyer’s wallet address
    • seller_address: The seller’s wallet address
    • send_amount: The amount to be sent
    • receive_amount: The amount to be received
    • uniqueness_amount: The amount of cents added to the order for uniqueness
    • receiving_chain_id: The chain ID where the payment will be received
    • zelle_address: The Zelle address for payment

Connecting Everything

Add this script to connect your form to the payment flow:

Complete Implementation Example

Here’s a complete example showing how to implement the Phoenix payment in an HTML page: