Obtaining Access Token
Learn how to generate and manage access tokens for Phoenix integration
Client Credentials Required
To use Phoenix payments, you’ll need a client ID and client secret. You can request these by:
- Emailing us at main@phoenix.market
- Including your company name and intended use case
- We’ll respond within 1 business day with your client credentials and additional integration support
Overview
To integrate Phoenix, you need to obtain an access token through an OAuth-like flow. This token must be retrieved from your backend and passed to the frontend for use in the integration.
Token Generation
Required Parameters
Parameter | Description | Example |
---|---|---|
client_id | Your client ID provided by the Phoenix team | "2SERtJ2DPnkkTQbvnqyS5y" |
client_secret | Your client secret provided by the Phoenix team | "a1b2c3d4e5..." |
grant_type | The grant type (always use "client_credentials" ) | "client_credentials" |
Endpoint
Response Example
Important Security Considerations
The access token does not need to be generated on a per-user basis. You can use the same access token across all your users. A recommended practice is to set up a cron job that runs every hour to refresh your access_token and store it on your backend for all your users to share.
-
Store credentials securely: Your
client_id
andclient_secret
should never be exposed in frontend code. -
Token lifespan: Access tokens are valid for 1 hour (3600 seconds). Set up a cron job on your backend to refresh the token hourly.
-
Token storage: Store the current valid access token securely on your backend and provide an API endpoint for your frontend to retrieve it.
-
Domain whitelisting: Phoenix will be implementing domain whitelisting and additional security measures in the future. Keep your integration up to date by checking documentation regularly.
Using the Access Token
Once obtained, the access token should be included in the Phoenix iframe URL:
Implementation Best Practices
-
Backend endpoint: Create a secure endpoint on your backend that retrieves and returns a valid access token to your frontend.
-
Token caching: Cache the token on your backend with an expiration slightly shorter than the token’s expiration time.
-
Error handling: Implement robust error handling for cases where token generation fails.
-
Automatic refresh: Set up automatic token refreshing before expiration to prevent disruption to your users.