> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xpaycheckout.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Webhook Configuration

> Create a webhook configuration to receive realtime events for payments, intents, subscriptions, payouts, or setup methods.



## OpenAPI

````yaml POST /webhook
openapi: 3.0.1
info:
  title: xPay API Store
  description: ''
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.xpaycheckout.com
security:
  - basicAuth: []
paths:
  /webhook:
    post:
      description: >-
        Create a webhook configuration to receive realtime events for payments,
        intents, subscriptions, payouts, or setup methods.
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create-webhook-request'
        required: true
      responses:
        '200':
          description: >-
            Webhook configuration created successfully. Returns the identifier
            of the newly created webhook.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/create-webhook-response'
        '204':
          description: Webhook configuration created successfully. No content is returned.
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
        pattern: ^[a-zA-Z0-9\-_:\.]+$
      description: >-
        A unique key for making the request idempotent. Must match pattern:
        `^[a-zA-Z0-9\-_:\.]+$`. See [Idempotent
        Requests](/developer-resources/idempotency) for more details.
      example: KG5LxwFBepaKHyUD
  schemas:
    create-webhook-request:
      type: object
      required:
        - eventSigner
        - endpoint
        - subscribedEventTypes
      properties:
        eventSigner:
          type: string
          description: >-
            Secret used to sign outbound webhook events. Provide a value that
            you will use to verify the signature.
          example: secret_key
        endpoint:
          type: string
          description: Public **HTTPS** URL where **xPay** should `POST` webhook events.
          example: https://your-webhook-endpoint.com/webhook
        subscribedEventTypes:
          type: array
          description: >-
            List of event types to subscribe to. Refer to [webhook
            events](/developer-resources/webhooks/events-list) for the full list
            of available events.
          items:
            type: string
          example:
            - intent.created
            - intent.success
            - intent.failed
            - intent.refunded
            - intent.checkout_opened
            - subscription.trialing
            - subscription.cycle_charged
    create-webhook-response:
      type: object
      description: >-
        Response payload returned after successfully creating a webhook
        configuration.
      properties:
        webhookConfigId:
          type: string
          description: Identifier of the newly created webhook configuration.
          example: whc_gKAi2oZN1AeU7BfV
      required:
        - webhookConfigId
    Error:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          type: string
          example: bad_request
        errorDescription:
          type: string
          example: Failed to read request
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````