Webhook Setup
Configure webhooks to receive real-time notifications about events in your Inkress account.
What are Webhooks?
Webhooks allow Inkress to send real-time notifications to your server when important events occur in your account. Instead of constantly polling our API for updates, webhooks push data to your application as soon as events happen.
Common use cases: Send order confirmation emails, update inventory after payments, trigger fulfillment workflows, sync transaction data to accounting systems, and notify customers of payout status.
Creating a Webhook Endpoint
1. Set Up Your Server Endpoint
Create an HTTP endpoint on your server that can receive POST requests from Inkress. Here's a basic example:
1// Remix action example2export async function action({ request }: ActionFunctionArgs) {3 if (request.method !== 'POST') {4 return json({ error: 'Method not allowed' }, { status: 405 });5 }67 // Parse webhook payload8 const payload = await request.json();9 10 // Verify webhook signature (see Security section)11 const signature = request.headers.get('X-Inkress-Signature');12 if (!verifyWebhookSignature(payload, signature)) {13 return json({ error: 'Invalid signature' }, { status: 401 });14 }1516 // Process the webhook event17 const { event_type, data } = payload;18 19 switch (event_type) {20 case 'payment.success':21 await handlePaymentSuccess(data);22 break;23 case 'order.created':24 await handleOrderCreated(data);25 break;26 // ... handle other events27 }2829 // Return 200 to acknowledge receipt30 return json({ received: true });31}2. Register Your Webhook URL
Add your webhook endpoint URL in the Inkress dashboard or via the API:
Via Dashboard
- Navigate to Settings → Webhooks
- Click "Add Endpoint"
- Enter your webhook URL (e.g., https://yoursite.com/webhooks/inkress)
- Select which events you want to receive
- Save your webhook configuration
Via API
1const response = await admin.webhookUrls.create({2 url: 'https://yoursite.com/webhooks/inkress',3 events: [4 'payment.success',5 'payment.failed',6 'order.created',7 'payout.completed'8 ],9 status: 1 // active10});3. Test Your Webhook
Use the dashboard to send test events to your endpoint:
- Go to Settings → Webhooks
- Select your webhook endpoint
- Click "Send Test Event"
- Choose an event type to simulate
- Verify your server receives and processes the test payload
Best Practices
1. Return 200 Quickly
Your endpoint should return a 200 OK response as quickly as possible. Process webhook data asynchronously to avoid timeouts.
1export async function action({ request }: ActionFunctionArgs) {2 const payload = await request.json();3 4 // Queue for async processing5 await jobQueue.add('process-webhook', payload);6 7 // Return immediately8 return json({ received: true });9}2. Handle Idempotency
Webhooks may be sent multiple times. Use the event ID to ensure you only process each event once.
1const { id, event_type, data } = payload;23// Check if we've already processed this event4const existing = await db.webhookEvent.findUnique({ where: { id } });5if (existing) {6 return json({ received: true }); // Already processed7}89// Store the event ID10await db.webhookEvent.create({ data: { id, processed_at: new Date() } });1112// Process the event13await processEvent(event_type, data);3. Use HTTPS
Always use HTTPS endpoints in production to ensure webhook data is encrypted in transit. Inkress will reject non-HTTPS URLs for production webhooks.
4. Monitor Webhook Deliveries
Check the webhook delivery logs in your dashboard to monitor success rates and debug failures.
5. Implement Retry Logic
If your endpoint is temporarily down, Inkress will retry failed webhook deliveries with exponential backoff. However, you should also implement your own fallback mechanisms.
Retry Policy
If your endpoint returns a non-2xx status code or times out, Inkress will automatically retry the webhook delivery:
Immediate retry after 1 minute
Second retry after 5 minutes
Third retry after 30 minutes
Fourth retry after 2 hours
Final retry after 6 hours
After all retry attempts fail, the webhook delivery is marked as failed. You can manually retry failed deliveries from the dashboard.
Troubleshooting
Webhooks Not Receiving
- Verify your endpoint URL is publicly accessible
- Check that you're listening for POST requests
- Ensure your firewall allows incoming requests from Inkress
- Verify HTTPS certificate is valid (not self-signed)
Timeouts
- Endpoint must respond within 30 seconds
- Move long-running processes to background jobs
- Return 200 immediately and process asynchronously
Invalid Signatures
- Verify you're using the correct webhook signing secret
- Check that you're computing the signature correctly
- Ensure you're using the raw request body (not parsed JSON)