# Link status changed

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: ''
  description: ''
  version: 1.0.0
paths: {}
webhooks:
  payment_link.status_changed:
    post:
      summary: Link status changed
      deprecated: false
      description: Sent when a link status changes (e.g., ACTIVE -> INACTIVE or EXPIRED).
      tags:
        - Webhooks
        - Webhooks
      parameters:
        - name: User-Agent
          in: header
          description: Delivery user agent. Always sent as `SXPay-Webhook/1.0`.
          required: true
          example: SXPay-Webhook/1.0
          schema:
            type: string
        - name: x-sxpay-signature
          in: header
          description: >
            HMAC-SHA256 hex digest of "{timestamp}.{rawBody}" using the payment
            link webhookSecret. Sent only when a webhookSecret is configured.
          required: false
          example: ''
          schema:
            type: string
        - name: x-sxpay-timestamp
          in: header
          description: >-
            Unix epoch timestamp in milliseconds used with signature
            verification.
          required: false
          example: ''
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookPaymentLinkStatusChangedEvent'
            example:
              id: 7b1e3e7f-1a23-4c55-8ef1-b12cd3fae7c1
              type: payment_link.status_changed
              createdAt: '2024-12-05T18:32:12.000Z'
              data:
                id: 01KDKM3H65KCYAVMJTM8TBV8Y6
                title: Payment Title
                description: Payment Description
                externalReference: 4ebd0208-8328-5d69-8c44-ec50939c0967
                status: INACTIVE
                previousStatus: ACTIVE
                isMultiUse: false
                expiresAt: '2025-01-31T23:59:59.000Z'
                amount: 129.9
                currency: USD
                url: >-
                  https://app.sxdigitalpay.com/quote/[merchantShortName]/[paymentLinkId]
                shortUrl: https://sxpay.me/[paymentLinkShortId]
                metadata: null
                createdAt: '2024-12-05T18:20:00.000Z'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
                x-apidog-orders: []
                x-apidog-ignore-properties: []
          headers: {}
          x-apidog-name: Success
      security:
        - ApiKeyAuth: []
          x-apidog:
            schemeGroups:
              - id: aSabarTaLKMkoazJDLTtw
                schemeIds:
                  - ApiKeyAuth
            required: true
            use:
              id: aSabarTaLKMkoazJDLTtw
            scopes:
              aSabarTaLKMkoazJDLTtw:
                ApiKeyAuth: []
      x-apidog-folder: Webhooks
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1147027/apis/api-25254367-run
components:
  schemas:
    WebhookPaymentLinkStatusChangedEvent:
      type: object
      properties:
        id:
          type: string
          format: uuid
        type:
          type: string
          enum:
            - payment_link.status_changed
        createdAt:
          type: string
          format: date-time
        data:
          $ref: '#/components/schemas/WebhookLinkStatusChangedPayload'
      required:
        - id
        - type
        - createdAt
        - data
      x-apidog-orders:
        - id
        - type
        - createdAt
        - data
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    WebhookLinkStatusChangedPayload:
      allOf:
        - $ref: '#/components/schemas/WebhookLinkPayloadBase'
        - type: object
          properties:
            previousStatus: &ref_0
              $ref: '#/components/schemas/PaymentLinkStatus'
          required:
            - previousStatus
          x-apidog-orders:
            - previousStatus
          x-apidog-ignore-properties: []
      x-apidog-folder: ''
    PaymentLinkStatus:
      type: string
      enum:
        - ACTIVE
        - INACTIVE
        - EXPIRED
      x-apidog-folder: ''
    WebhookLinkPayloadBase:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
        description:
          type:
            - string
            - 'null'
        externalReference:
          type:
            - string
            - 'null'
        status: *ref_0
        isMultiUse:
          type: boolean
          description: Always false for this API.
        expiresAt:
          type:
            - string
            - 'null'
          format: date-time
        amount:
          type: number
        currency:
          type: string
        url:
          type: string
          format: uri
        shortUrl:
          type: string
          format: uri
        metadata:
          type:
            - object
            - 'null'
          additionalProperties: true
          properties: {}
          x-apidog-orders: []
          x-apidog-ignore-properties: []
        createdAt:
          type: string
          format: date-time
      required:
        - id
        - title
        - status
        - isMultiUse
        - amount
        - currency
        - url
        - shortUrl
      x-apidog-orders:
        - id
        - title
        - description
        - externalReference
        - status
        - isMultiUse
        - expiresAt
        - amount
        - currency
        - url
        - shortUrl
        - metadata
        - createdAt
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes:
    ApiKeyAuth:
      type: apikey
      in: header
      name: x-api-key
      description: >-
        API key provisioned per merchant. Authorization: Bearer <api-key> is
        also accepted.
    WebhookSignature:
      type: apikey
      in: header
      name: x-sxpay-signature
      description: >
        HMAC-SHA256 signature calculated over "{timestamp}.{rawBody}" using the
        link's webhookSecret. Includes header x-sxpay-timestamp (epoch ms) for
        replay protection. These headers are only sent when a webhookSecret is
        configured for the link.
servers:
  - url: https://sandbox.sxdigitalpay.com/api/v1
    description: Sandbox
  - url: https://app.sxdigitalpay.com/api/v1
    description: Prod
security:
  - ApiKeyAuth: []
    x-apidog:
      schemeGroups:
        - id: aSabarTaLKMkoazJDLTtw
          schemeIds:
            - ApiKeyAuth
      required: true
      use:
        id: aSabarTaLKMkoazJDLTtw
      scopes:
        aSabarTaLKMkoazJDLTtw:
          ApiKeyAuth: []

```
