• Example searches: “transaction”, “CreateOrder”, “/v2/locations”, “inventory”, “delete customer”

You are viewing an old version of the API
Create webhook subscription BETA

POST /v2/webhooks/subscriptions

Creates a webhook subscription.

Name Description
idempotency_key
string

A unique string that identifies the CreateWebhookSubscription request.

Max Length 45
subscription
WebhookSubscription

Required

The Subscription to create.

Response Fields

Name Description
errors
Error [ ]

Information on errors encountered during the request.

subscription
WebhookSubscription

The new Subscription.

Examples

You are viewing an old version of the API
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: 2022-09-21' \
  -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"
  }
}