Webhook Integration Best Practices

Follow these best practices to ensure your webhook integration is secure, reliable, and successful.

Endpoint design

  • Make your webhook endpoint idempotent (safe to call multiple times).
  • Process webhooks asynchronously to avoid timeouts.
  • Log all webhook deliveries for debugging purposes.
  • Implement proper error handling and monitoring.

Security

  • Use an https URL with a valid certificate for your webhook endpoint. Infinicept does not send webhooks to http URLs. See Prepare Your Endpoint in the Webhook Setup Guide.
  • Verify webhook authenticity using the provided authentication method.
  • Store authentication credentials securely.

Reliability

  • Respond quickly (under 30 seconds) to avoid timeouts.
  • Return appropriate HTTP status codes.
  • Monitor webhook delivery success rates.

Example integration

// Express.js example
app.post('/webhooks/funding-deposit-funded', (req, res) => {
  const payload = req.body;
  
  // Verify authentication (implement based on your chosen method)
  if (!verifyAuthentication(req)) {
    return res.status(401).send('Unauthorized');
  }
  
  // Process the webhook
  console.log('Funding deposit funded:', {
    tenantSlug: payload.tenantSlug,
    fundingDepositId: payload.fundingDepositId,
    status: payload.fundingStatus
  });
  
  // Update your system accordingly
  updateFundingDepositStatus(payload.fundingDepositId, payload.fundingStatus);
  
  // Return success response
  res.status(200).send('OK');
});

Test your integration

Complete the steps below to verify your webhook integration results.

  1. Create a test subscription pointing to your webhook endpoint. Test endpoints must also use https and a public internet address, so a localhost URL is not accepted.
  2. Trigger a funding deposit event in your test environment.
  3. Verify your endpoint receives the webhook with the correct payload.
  4. Confirm that your response handling returns appropriate HTTP status codes.
  5. Test your authentication method by sending requests with invalid credentials.

Troubleshooting

See our recommendations for resolving common webhook issues below.

Issue 1: The subscription request was rejected.

  • Read the message in the 400 response. It names the requirement the DestinationURL did not meet. See Destination URL Errors in the Webhook Setup Guide.
  • Confirm the URL starts with https:// and includes the full hostname.
  • Confirm the hostname resolves to a public internet address, not a localhost address.

Issue 2: The webhook was not received.

  • Verify that your subscription is active and configured correctly. See our Webhook Setup Guide for details.
  • Check that your endpoint is accessible from external networks.
  • Ensure your endpoint returns 2xx status codes.
  • Review your server logs for any errors that may have occurred during processing.
  • Confirm your endpoint's TLS certificate is valid, unexpired, and issued for the hostname in your DestinationURL.
  • If your endpoint redirects, confirm the redirect target also uses https and a public internet address.
  • Use Review Webhook Sends to see each delivery attempt. When a send fails, its error field explains why.

Issue 3: Authentication failed.

  • Verify that the credentials in your subscription match your endpoint's expectations.
  • Check that the authentication headers are being processed correctly.
  • Ensure that your credentials have not expired or been rotated.

Issue 4: There was an issue with the webhook payload.

  • Confirm that your endpoint can accept the JSON payload format.
  • Check for any unexpected field names or data types.
  • Validate that your parsing logic matches the documented schema.

Support

For support with webhook setup, consult your existing API documentation or send us your request on the Customer Support Portal with your webhook subscription ID and specific error details.


What’s Next

Did this page help you?