@bates-solutions/squareup API Reference - v3.2.0
    Preparing search index...

    Class WebhookSubscriptionsService

    Manage Square webhook subscriptions (create / list / get / update / delete / test / rotate signature key). Exposed as square.webhooks.subscriptions.

    // Idempotent create: list first, don't duplicate by URL
    const { data } = await square.webhooks.subscriptions.list();
    const existing = data.find((s) => s.notificationUrl === url);

    const created = await square.webhooks.subscriptions.create({
    name: 'platform-order-events',
    eventTypes: ['payment.updated', 'order.updated', 'refund.updated'],
    notificationUrl: url,
    });
    created.signatureKey; // present here ONLY — persist it now
    Index
    • Rotate a subscription's signature key, returning a new key.

      Useful when the original key (returned only from create) wasn't persisted — rotate to obtain a usable key without deleting/recreating the subscription. Rotating invalidates the previous key, so deploy the new key before Square signs the next delivery with it.

      Parameters

      • subscriptionId: string
      • Optionaloptions: { idempotencyKey?: string }

      Returns Promise<{ signatureKey?: string }>

    • Send a test event to a subscription to verify the endpoint.

      Parameters

      • subscriptionId: string

        Subscription to test

      • Optionaloptions: { eventType?: string }

        Optional specific event type to send

      Returns Promise<SubscriptionTestResult>