Webhooks
Set up webhooks to receive real-time notifications about order events
Overview
Webhooks allow your application to receive real-time notifications when events occur in Phoenix. When an order is created or its status changes, Phoenix can automatically send an HTTP POST request to your specified webhook endpoints.
Getting Started
1. Obtain Webhook API Key
Before setting up webhooks, you need to obtain a webhook API key from Phoenix:
- Contact our support team at main@phoenix.market
- Request webhook access for your integration
- You’ll privately receive a
webhook_secret
value that will be used for webhook authentication - This key will be sent to your API in the
Authorization
header asBearer <webhook_secret>
in each invocation of your webhook
2. Define Your Webhook Endpoints
Your webhook endpoints should:
- Accept POST requests
- Return a
200
status code to acknowledge receipt - Process the webhook payload within 30 seconds
- Validate the
Authorization
header - Handle duplicate events gracefully (use
orderId
for idempotency)
3. Share Your Webhook Endpoint URLs
Once you’ve defined your webhook endpoints, you need to share the exact URLs with Phoenix:
- Determine the full URL path where you want to receive webhooks (e.g.,
https://yourdomain.com/webhooks/phoenix-status-updates
) - Contact our support team at main@phoenix.market with your webhook endpoint URL
- Phoenix will configure the system to send webhook events to your specified URL
Querying Orders
You can query order details at any time using the Phoenix API. This is useful for getting the complete order information or checking the current status.
You can use this endpoint to test your connection to the Phoenix service before setting up webhooks.
Endpoint
Example Request
Example Response
Order Status Update Webhook
Endpoint Configuration
Endpoint: /phoenix-order-status-updated
Event Type: order.status.change
Triggered: When an order’s status changes
Common Status Values
fulfilled
- Order has been completed successfullyexpired
- Order expired before completionpending
- Order is awaiting processing
Implementation Example
Payload Structure
Authentication
Phoenix uses Bearer token authentication for webhooks:
- Header:
Authorization: Bearer <webhook_secret>
- Webhook Secret: Provided by Phoenix support team
- Validation: Always verify the authorization header exists and contains a valid Bearer token
Best Practices
- Validate Authentication: Always check the
Authorization
header - Validate Required Fields: Ensure all required fields are present
- Implement Idempotency: Use
orderId
to handle duplicate events - Respond Quickly: Process webhooks within 30 seconds
- Log Events: Keep logs for debugging and monitoring
- Use HTTPS: Only accept webhooks over secure HTTPS connections
- Handle Errors Gracefully: Return appropriate HTTP status codes
Support
For webhook-related questions or to request webhook access:
- Email: main@phoenix.market