> ## 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.

# Configure Stripe Secret Key

> Validate and store a Stripe secret key. New Stripe accounts attempt managed webhook setup and then run a unified sync.



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/payments.yaml put /api/payments/stripe/{environment}/config
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/payments/stripe/{environment}/config:
    put:
      tags:
        - Stripe Payments
      summary: Configure Stripe Secret Key
      description: >-
        Validate and store a Stripe secret key. New Stripe accounts attempt
        managed webhook setup and then run a unified sync.
      parameters:
        - $ref: '#/components/parameters/EnvironmentPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertStripeConfigBody'
            example:
              secretKey: sk_test_xxx
      responses:
        '200':
          description: Updated Stripe key configuration
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetStripeConfigResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      security:
        - bearerAuth: []
        - apiKey: []
components:
  parameters:
    EnvironmentPath:
      name: environment
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/PaymentEnvironment'
      description: Payment provider environment.
  schemas:
    UpsertStripeConfigBody:
      type: object
      required:
        - secretKey
      additionalProperties: false
      properties:
        secretKey:
          type: string
          minLength: 1
          writeOnly: true
          example: sk_test_xxx
    GetStripeConfigResponse:
      type: object
      required:
        - keys
      properties:
        keys:
          type: array
          items:
            $ref: '#/components/schemas/StripeKeyConfig'
    PaymentEnvironment:
      type: string
      enum:
        - test
        - live
    StripeKeyConfig:
      type: object
      required:
        - environment
        - hasKey
        - maskedKey
      properties:
        environment:
          $ref: '#/components/schemas/StripeEnvironment'
        hasKey:
          type: boolean
        maskedKey:
          type: string
          nullable: true
          example: sk_test_...abcd
    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'
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````