Skip to main content

Overview

Webhooks are a way for your application to receive real-time notifications when events occur in your account. When an event occurs, we send an HTTP POST request to the webhook’s configured URL. You can use webhooks to trigger custom code, workflows, or integrations in your application.

Creating Webhooks

You can create and manage webhooks directly from the JustPaid dashboard:
  1. Navigate to SettingsDeveloperWebhooks
  2. Click Create Webhook URL
  3. Enter your webhook endpoint URL
  4. Select the event types you want to subscribe to
  5. Click Save
Each webhook includes a signing secret that you can use to verify the authenticity of incoming requests.

Webhook Headers

Each webhook request includes the following headers for verification:

Signature Verification

To verify a webhook signature:
  1. Get the raw request body
  2. Concatenate the timestamp and body: {timestamp}.{body}
  3. Compute HMAC-SHA256 using your webhook signing secret
  4. Compare with the provided signature

Webhook Events

The following events can trigger a webhook:

INVOICE_PAYMENT_STATUS_CHANGE

Triggered when the payment status of an invoice changes. Possible statuses: SCHEDULED, PROCESSED, SENT, NEED_ACTION, COMPLETED, FAILED, CANCELLED, VOIDED

INVOICE_STATUS_CHANGE

Triggered when an invoice’s status changes (e.g., from draft to sent, or sent to paid).

INVOICE_CREATED

Triggered when a new invoice is created.

INVOICE_UPDATED

Triggered when an existing invoice is updated. This includes changes to line items, amounts, dates, or any other invoice fields.

CUSTOMER_CREATED

Triggered when a new customer is created.

CUSTOMER_CONTRACT_CREATED

Triggered when a new contract is created for a customer.

PRODUCT_CREATED

Triggered when a new product is created.

PRODUCT_UPDATED

Triggered when an existing product is updated.

CREDIT_MEMO_CREATED

Triggered when a new credit memo is created. Credit memos are used to handle refunds and credits.

CREDIT_MEMO_UPDATED

Triggered when an existing credit memo is updated.

CREDIT_MEMO_STATUS_CHANGE

Triggered when a credit memo’s status changes.

Delivery

  • Webhooks are delivered asynchronously
  • Automatic retries on failure (up to 3 attempts with exponential backoff)
  • Each event has a unique id for idempotency
  • Events are delivered in order when possible, but you should handle out-of-order delivery

Best Practices

  1. Respond quickly - Return a 2xx status code within 30 seconds
  2. Process asynchronously - Queue webhook events for background processing
  3. Verify signatures - Always validate the X-JustPaid-Signature header
  4. Handle duplicates - Use the event id for idempotency
  5. Log events - Keep records for debugging and auditing