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

# Receive Stripe Webhook

> Receive Stripe events for one environment. The request body must be the raw Stripe JSON body and must include the Stripe signature header.



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/payments.yaml post /api/webhooks/stripe/{environment}
openapi: 3.0.3
info:
  title: Insforge Payments API
  version: 1.0.0
  description: >-
    Provider-specific Stripe and Razorpay payment setup, runtime flows, catalog
    management, sync, and webhook projections
servers: []
security: []
tags:
  - name: Stripe Payments
    description: >-
      Stripe Checkout, Billing Portal, catalog, sync, customer, subscription,
      and transaction routes
  - name: Razorpay Payments
    description: >-
      Razorpay Orders, Subscriptions, catalog, manual webhook setup, sync,
      customer, and transaction routes
  - name: Payment Webhooks
    description: Provider webhook ingestion routes
paths:
  /api/webhooks/stripe/{environment}:
    post:
      tags:
        - Payment Webhooks
      summary: Receive Stripe Webhook
      description: >-
        Receive Stripe events for one environment. The request body must be the
        raw Stripe JSON body and must include the Stripe signature header.
      parameters:
        - $ref: '#/components/parameters/EnvironmentPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
      responses:
        '200':
          description: Webhook received
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StripeWebhookResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - stripeSignature: []
components:
  parameters:
    EnvironmentPath:
      name: environment
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/PaymentEnvironment'
      description: Payment provider environment.
  schemas:
    StripeWebhookResponse:
      type: object
      required:
        - received
        - handled
      properties:
        received:
          type: boolean
        handled:
          type: boolean
        event:
          $ref: '#/components/schemas/StripeWebhookEvent'
    PaymentEnvironment:
      type: string
      enum:
        - test
        - live
    StripeWebhookEvent:
      type: object
      required:
        - environment
        - eventId
        - eventType
        - livemode
        - accountId
        - objectType
        - objectId
        - processingStatus
        - attemptCount
        - lastError
        - receivedAt
        - processedAt
        - createdAt
        - updatedAt
      properties:
        environment:
          $ref: '#/components/schemas/StripeEnvironment'
        eventId:
          type: string
          example: evt_123
        eventType:
          type: string
          example: checkout.session.completed
        livemode:
          type: boolean
        accountId:
          type: string
          nullable: true
          example: acct_123
        objectType:
          type: string
          nullable: true
          example: checkout.session
        objectId:
          type: string
          nullable: true
          example: cs_test_123
        processingStatus:
          $ref: '#/components/schemas/StripeWebhookProcessingStatus'
        attemptCount:
          type: integer
        lastError:
          type: string
          nullable: true
        receivedAt:
          type: string
          format: date-time
        processedAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      required:
        - error
        - message
        - statusCode
      properties:
        error:
          type: string
          example: INVALID_INPUT
        message:
          type: string
          example: 'environment: Invalid enum value'
        statusCode:
          type: integer
          example: 400
        nextActions:
          type: string
          nullable: true
    StripeEnvironment:
      $ref: '#/components/schemas/PaymentEnvironment'
    StripeWebhookProcessingStatus:
      type: string
      enum:
        - pending
        - processed
        - failed
        - ignored
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    stripeSignature:
      type: apiKey
      in: header
      name: stripe-signature

````