Subscribe to webhooks
Create and manage webhook subscriptions from the dashboard or over the API.
A webhook subscription pairs one endpoint URL with a list of events. Create one when you want Preczn to notify your system about changes instead of polling the API. The Dashboard and the API manage the same subscriptions, so you can create a subscription one way and edit it the other way.
A subscription has these values:
| Value | Required | Description |
|---|---|---|
| Endpoint URL | Yes | The URL Preczn sends each notification to. Use HTTPS |
| Events | Yes | The events to receive. See Webhook events |
| Active | Yes | Whether the subscription delivers notifications |
| Description | No | A label for your own reference |
| Custom header and value | No | One extra HTTP header sent with every notification |
Preczn generates two more values that you can't set:
- Subscription ID: starts with
wh_in Live mode andwh_test_in Test mode. - Signing secret: signs every notification from this subscription. See Receive and verify webhooks.
Signing secrets don't rotate. A subscription keeps the same secret until you delete it.
One subscription, one mode
A subscription receives events only from the mode it was created in. To receive the same events in Live and Test mode, create one subscription in each. See Live vs. test mode.
Creating a subscription
Choose how you'll create the subscription. Select the Dashboard tab or the API tab.
- Go to Settings → Webhooks.
- Select Create Webhook.
- In Details, enter the Endpoint URL. Optionally, enter a Description.
- Optionally, under Authorization, enter an HTTP Header and a Header Value. Preczn sends this header with every notification, so your endpoint can authenticate the request.
- Under Events, select the events to receive. The events are grouped in two sections, Merchant and Transactions & loans.
- Select Create Webhook.
merchant.createdmerchant.updatedmerchant.deletedlocation.createdlocation.updatedlocation.deletedform.createdform.startedform.updatedform.completedform.expiredtransaction.approvedtransaction.pendingtransaction.declinedtransaction.erroredloan.createdloan.updatedA subscription created in the Dashboard is active and starts delivering right away.
- Send the subscription to
POST /v1/webhookswith a private API key. The key's mode sets the subscription's mode. SendendpointUrl,events, andactiveon every create.
{
"endpointUrl": "https://{your-domain}/hooks/preczn",
"active": true,
"description": "{description}",
"httpHeaderKey": "{header-name}",
"httpHeaderValue": "{header-value}",
"events": [
"transaction.approved",
"merchant.updated",
"form.completed"
]
}{
"id": "{webhookId}",
"endpointUrl": "https://{your-domain}/hooks/preczn",
"events": [
"transaction.approved",
"merchant.updated",
"form.completed"
],
"active": true,
"isTestMode": true,
"failedCount": 0,
"signingSecret": "{signingSecret}"
}The response is the new subscription, including its id and signingSecret. This response is abbreviated.
Save the signing secret from this response
The API returns the signing secret in the create response and in Get Webhook (
GET /v1/webhooks/{webhookId}). Listing webhooks doesn't return it. You can also reveal it in the Dashboard under Settings → Webhooks. Any private API key on your platform can read it, so protect your private keys.
A new subscription receives only events that happen after you create it.
Editing or disabling a subscription
A disabled subscription keeps its ID, signing secret, and delivery history, but it receives nothing. Events that happen while it's disabled aren't delivered later. Choose how you'll change the subscription. Select the Dashboard tab or the API tab.
- Go to Settings → Webhooks.
- Do one of the following on the subscription's row:
- To edit it, select Edit, change the values, and then select Save Changes. The Status switch on the same page turns the subscription on or off.
- To turn it off or on, open the row's actions menu, select Disable or Enable, and then select Confirm.
- Send the subscription's full settings to
PATCH /v1/webhooks/{webhookId}. SendendpointUrl,events, andactiveon every update, even when they don't change. To add one event, send the full list including the new event. To disable the subscription, send"active": false.
{
"endpointUrl": "https://{your-domain}/hooks/preczn",
"active": false,
"events": [
"transaction.approved",
"merchant.updated",
"form.completed"
]
}If you leave out description, httpHeaderKey, or httpHeaderValue, the subscription keeps its current value.
A change to the events takes effect for later events only. Editing a subscription doesn't change its ID or signing secret. To re-enable a subscription that Preczn disabled after repeated failures, see Webhook delivery, retries, and failures.
Viewing subscriptions
Choose how you'll view your subscriptions. Select the Dashboard tab or the API tab.
- Go to Settings → Webhooks. The list shows each subscription's ID, URL, description, events, and status.
- To see a subscription's signing secret, open the row's actions menu and select Reveal signing secret.
- To see its delivery history, open the row's actions menu and select Webhook Attempts.
- To get one subscription, including its signing secret, call
GET /v1/webhooks/{webhookId}. - To list subscriptions for the key's platform and mode, call
GET /v1/webhooks. The list returns up to 50 subscriptions and doesn't include signing secrets.
Deleting a subscription
Deleting a subscription is permanent. If you might want it back, disable it instead. Choose how you'll delete the subscription. Select the Dashboard tab or the API tab.
- Go to Settings → Webhooks.
- Open the subscription's actions menu and select Delete.
- Select Confirm.
- Call
DELETE /v1/webhooks/{webhookId}. The request has no body, and a successful call returns204.
Errors
These errors apply to the /v1/webhooks endpoints.
| Status | Cause |
|---|---|
400 | A required field is missing, an event isn't in Webhook events, or endpointUrl isn't a valid URL |
401 | The API key is missing or inactive, or its mode doesn't match the subscription's mode |
403 | The API key is a public key, or the subscription belongs to another platform |
404 | No subscription has that ID |
FAQ
Should I use the Dashboard or the API?
Use either one. They manage the same subscriptions. The API suits environment setup that runs without anyone signing in. Only the Dashboard shows delivery history and resends past transaction notifications.
Can two subscriptions point at the same URL?
Yes. Each subscription has its own signing secret, events, and failure counter, and each one delivers separately. Your URL receives one notification for each matching subscription.
Can I set more than one custom header?
No. A subscription sends one custom header. To confirm that a request came from Preczn, verify its signature. The custom header is for your endpoint's own authentication.
Updated 11 days ago
