Skip to Content
AdvancedWebhooks

Webhooks

Receive real-time notifications when events happen in your marketplace.

Setup

Register a webhook endpoint in your dashboard or via the API:

await market.webhooks.create({ url: 'https://your-server.com/api/webhooks/sendd', events: ['order.created', 'order.fulfilled', 'payment.received'], secret: process.env.SENDD_WEBHOOK_SECRET })

Verifying Signatures

Always verify webhook signatures to ensure requests are authentic:

import { verifyWebhookSignature } from '@sendd/market-sdk' export async function POST(request: Request) { const body = await request.text() const signature = request.headers.get('x-sendd-signature') const isValid = verifyWebhookSignature({ body, signature, secret: process.env.SENDD_WEBHOOK_SECRET! }) if (!isValid) { return new Response('Invalid signature', { status: 401 }) } const event = JSON.parse(body) switch (event.type) { case 'order.created': // Handle new order break case 'payment.received': // Handle payment break } return new Response('OK', { status: 200 }) }

Available Events

EventDescription
order.createdA new order was placed
order.fulfilledAn order was marked as fulfilled
order.cancelledAn order was cancelled
payment.receivedA payment was successfully processed
payment.failedA payment attempt failed
listing.createdA new listing was published
listing.updatedA listing was modified
customer.createdA new customer signed up

Retry Policy

Failed webhook deliveries are retried with exponential backoff:

  • 1st retry: 1 minute
  • 2nd retry: 5 minutes
  • 3rd retry: 30 minutes
  • 4th retry: 2 hours
  • 5th retry: 24 hours

After 5 failed attempts, the webhook is disabled and you receive an email notification.