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:- Navigate to Settings → Developer → Webhooks
- Click Create Webhook URL
- Enter your webhook endpoint URL
- Select the event types you want to subscribe to
- Click Save
Webhook Headers
Each webhook request includes the following headers for verification:| Header | Description |
|---|---|
X-JustPaid-Timestamp | Unix timestamp when the webhook was sent |
X-JustPaid-Signature | HMAC-SHA256 signature in format v1={sha256_hex} |
Signature Verification
To verify a webhook signature:- Get the raw request body
- Concatenate the timestamp and body:
{timestamp}.{body} - Compute HMAC-SHA256 using your webhook signing secret
- Compare with the provided signature
Webhook Events
The following events can trigger a webhook:| Event Type | Description |
|---|---|
INVOICE_PAYMENT_STATUS_CHANGE | Payment status changed on an invoice |
INVOICE_STATUS_CHANGE | Invoice status changed (e.g., draft → sent) |
INVOICE_CREATED | A new invoice was created |
INVOICE_UPDATED | An existing invoice was updated |
CUSTOMER_CREATED | A new customer was created |
CUSTOMER_CONTRACT_CREATED | A new contract was created for a customer |
PRODUCT_CREATED | A new product was created |
PRODUCT_UPDATED | An existing product was updated |
CREDIT_MEMO_CREATED | A new credit memo was created |
CREDIT_MEMO_UPDATED | An existing credit memo was updated |
CREDIT_MEMO_STATUS_CHANGE | Credit memo status changed |
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
idfor idempotency - Events are delivered in order when possible, but you should handle out-of-order delivery
Best Practices
- Respond quickly - Return a 2xx status code within 30 seconds
- Process asynchronously - Queue webhook events for background processing
- Verify signatures - Always validate the
X-JustPaid-Signatureheader - Handle duplicates - Use the event
idfor idempotency - Log events - Keep records for debugging and auditing
