Create webhook subscription BETA
POST
/v2/webhooks/subscriptions
Creates a webhook subscription.
Name | Description |
---|---|
idempotency_
|
A unique string that identifies the CreateWebhookSubscription request. |
subscription
Required
|
The Subscription to create. |
Response Fields
Name | Description |
---|---|
errors
|
Information on errors encountered during the request. |
subscription
|
The new Subscription. |
Examples
POST
/v2/webhooks/subscriptions
cURL
- cURL
- Ruby
- Python
- C#
- Java
- PHP
- Node.js
curl https://connect.squareup.com/v2/webhooks/subscriptions \
-X POST \
-H 'Square-Version: 2023-01-19' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"idempotency_key": "63f84c6c-2200-4c99-846c-2670a1311fbf",
"subscription": {
"name": "Example Webhook Subscription",
"event_types": [
"payment.created",
"payment.updated"
],
"notification_url": "https://example-webhook-url.com",
"api_version": "2021-12-15"
}
}'
Response JSON
{
"subscription": {
"id": "wbhk_b35f6b3145074cf9ad513610786c19d5",
"name": "Example Webhook Subscription",
"enabled": true,
"event_types": [
"payment.created",
"payment.updated"
],
"notification_url": "https://example-webhook-url.com",
"api_version": "2021-12-15",
"signature_key": "1k9bIJKCeTmSQwyagtNRLg",
"created_at": "2022-01-10 23:29:48 +0000 UTC",
"updated_at": "2022-01-10 23:29:48 +0000 UTC"
}
}