Skip to main content

Webhook Integration

Open Market uses webhooks to notify your application when a payment is successful. Only successful transactions trigger webhook notifications. This real-time notification system allows you to automatically update your application’s state, fulfill orders, or trigger other business processes.

Webhook Authentication

Webhooks are authenticated using your private key. Each webhook request includes a signature in the opm-signature header that you should validate to ensure the webhook is legitimate. This prevents unauthorized parties from sending fake webhook events to your endpoint.

Webhook Payload

When a payment is successful, we’ll send a POST request to your configured webhook URL with the following JSON payload:

Handling Webhooks

Here’s an example of how to handle and validate webhooks:

Best Practices for Webhooks

Always validate the webhook signature using your private key to ensure the request is from Open Market.
Implement idempotency checks using the transaction_id to avoid processing the same webhook multiple times.
Implement proper error handling and logging for webhook processing failures.
Return a 200 status code quickly and process the webhook asynchronously if needed.
Implement a retry mechanism in case your server fails to process the webhook.

Webhook Use Cases

  • Simple payment confirmation
  • Update order status
  • Send confirmation emails
  • Basic logging of transactions
  • Order fulfillment automation
  • Inventory management
  • Customer notification system
  • Basic error handling and retries
  • Simple database storage
  • Distributed systems integration
  • Queue-based processing
  • Advanced error handling with retry mechanisms
  • Load balancing and scaling
  • Monitoring and alerting systems
  • Data analytics and reporting
  • Multi-region deployment
  • Microservices architecture
  • Event-driven systems
  • High availability setup
  • Disaster recovery
  • Compliance and audit logging
  • Advanced security measures
  • Performance optimization

Testing Webhooks

During development, you can use tools like ngrok to test webhooks locally:
Then update your webhook URL in the API Settings with the ngrok URL.
Remember to update your webhook URL to your production URL before going live.