Insforge Razorpay Payments API

Razorpay Orders, Subscriptions, catalog, manual webhook setup, sync, customer, and transaction routes

OpenAPI Specification

insforge-razorpay-payments-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Insforge AI Admin Razorpay Payments API
  version: 1.0.0
  description: Model Gateway helper APIs for OpenRouter key provisioning, model discovery, and deprecated compatibility proxy routes
tags:
- name: Razorpay Payments
  description: Razorpay Orders, Subscriptions, catalog, manual webhook setup, sync, customer, and transaction routes
paths:
  /api/payments/razorpay/status:
    get:
      summary: Get Razorpay Payments Status
      description: Return Razorpay connection and sync status for each environment.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      responses:
        '200':
          description: Razorpay payments status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetRazorpayStatusResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /api/payments/razorpay/config:
    get:
      summary: Get Razorpay Key Configuration
      description: Return masked Razorpay key configuration for test and live environments.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      responses:
        '200':
          description: Razorpay key configuration
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetRazorpayConfigResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /api/payments/razorpay/sync:
    post:
      summary: Sync Razorpay Payments State
      description: Sync items, plans, customers, subscriptions, invoices, and payments for every configured Razorpay environment. Razorpay remains the source of truth.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      responses:
        '200':
          description: Sync result for configured Razorpay environments
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncRazorpayPaymentsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /api/payments/razorpay/{environment}/config:
    put:
      summary: Configure Razorpay Keys
      description: Validate and store Razorpay API keys for one environment. A webhook secret is generated automatically when one does not already exist.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertRazorpayConfigBody'
            example:
              keyId: rzp_test_xxx
              keySecret: razorpay_secret_xxx
              webhookSecret: webhook_secret_xxx
      responses:
        '200':
          description: Updated Razorpay key configuration
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetRazorpayConfigResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
    delete:
      summary: Remove Razorpay Keys
      description: Remove the configured Razorpay keys for one environment.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      responses:
        '200':
          description: Updated Razorpay key configuration
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetRazorpayConfigResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /api/payments/razorpay/{environment}/sync:
    post:
      summary: Sync Razorpay Payments State For One Environment
      description: Sync items, plans, customers, subscriptions, invoices, and payments for one Razorpay environment. Razorpay remains the source of truth.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      responses:
        '200':
          description: Sync result for the requested Razorpay environment
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncRazorpayPaymentsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /api/payments/razorpay/{environment}/webhook:
    get:
      summary: Get Razorpay Webhook Setup Values
      description: Return the Razorpay webhook URL and signing secret that must be copied into the Razorpay Dashboard for manual webhook setup.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      responses:
        '200':
          description: Razorpay webhook setup values
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetRazorpayWebhookSetupResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /api/payments/razorpay/{environment}/webhook/rotate-secret:
    post:
      summary: Rotate Razorpay Webhook Secret
      description: Generate a new Razorpay webhook signing secret. Update the webhook secret in the Razorpay Dashboard after calling this endpoint.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      responses:
        '200':
          description: Razorpay webhook setup values with the rotated secret
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RotateRazorpayWebhookSecretResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /api/payments/razorpay/{environment}/orders:
    post:
      summary: Create Razorpay Order
      description: Create a local Razorpay Order record with the caller's user context, create a Razorpay Order, and return Checkout options for the client-side Razorpay Checkout script.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRazorpayOrderBody'
            example:
              amount: 50000
              currency: INR
              receipt: order-team_123-pro
              description: Pro upgrade
              subject:
                type: team
                id: team_123
              customerEmail: buyer@example.com
      responses:
        '201':
          description: Razorpay Order created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateRazorpayOrderResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalError'
  /api/payments/razorpay/{environment}/orders/verify:
    post:
      summary: Verify Razorpay Order Payment
      description: Verify the Razorpay Checkout signature for an order payment before recording the verified payment ID locally.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VerifyRazorpayOrderBody'
            example:
              orderId: order_123
              paymentId: pay_123
              signature: razorpay_signature
      responses:
        '200':
          description: Razorpay order payment verified
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VerifyRazorpayOrderResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /api/payments/razorpay/{environment}/catalog:
    get:
      summary: List Razorpay Payment Catalog
      description: Return mirrored Razorpay items and plans for one environment.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      responses:
        '200':
          description: Synced Razorpay items and plans
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListRazorpayCatalogResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /api/payments/razorpay/{environment}/catalog/items:
    post:
      summary: Create Razorpay Item
      description: Create a Razorpay Item, then mirror it locally after Razorpay succeeds.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRazorpayItemBody'
            example:
              name: One-time setup
              amount: 50000
              currency: INR
      responses:
        '201':
          description: Razorpay item created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MutateRazorpayItemResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /api/payments/razorpay/{environment}/catalog/items/{itemId}:
    patch:
      summary: Update Razorpay Item
      description: Update mutable Razorpay Item fields, then mirror the item locally after Razorpay succeeds.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      - $ref: '#/components/parameters/RazorpayItemIdPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRazorpayItemBody'
            example:
              active: false
      responses:
        '200':
          description: Razorpay item updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MutateRazorpayItemResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /api/payments/razorpay/{environment}/catalog/plans:
    post:
      summary: Create Razorpay Plan
      description: Create a Razorpay Plan with its amount-bearing item definition, then mirror it locally after Razorpay succeeds.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRazorpayPlanBody'
            example:
              period: monthly
              interval: 1
              item:
                name: Pro monthly
                amount: 199900
                currency: INR
      responses:
        '201':
          description: Razorpay plan created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MutateRazorpayPlanResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /api/payments/razorpay/{environment}/subscriptions:
    post:
      summary: Create Razorpay Subscription
      description: Create a Razorpay Subscription and mirror it locally, then return Checkout options for authorization. The backend first evaluates the caller's INSERT policy on payments.razorpay_subscriptions so apps can restrict which subjects can start subscriptions.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRazorpaySubscriptionBody'
            example:
              planId: plan_123
              totalCount: 12
              subject:
                type: team
                id: team_123
              customerEmail: buyer@example.com
      responses:
        '201':
          description: Razorpay subscription created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateRazorpaySubscriptionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalError'
    get:
      summary: List Razorpay Subscriptions
      description: Admin/debug read for mirrored Razorpay subscriptions. Use app-owned tables with RLS for end-user payment state.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      - $ref: '#/components/parameters/SubjectTypeQuery'
      - $ref: '#/components/parameters/SubjectIdQuery'
      - $ref: '#/components/parameters/LimitQuery'
      responses:
        '200':
          description: Razorpay subscriptions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListRazorpaySubscriptionsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /api/payments/razorpay/{environment}/subscriptions/verify:
    post:
      summary: Verify Razorpay Subscription Authorization
      description: Verify the Razorpay Checkout signature for the subscription authorization payment before recording the authorization payment ID locally.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VerifyRazorpaySubscriptionBody'
            example:
              subscriptionId: sub_123
              paymentId: pay_123
              signature: razorpay_signature
      responses:
        '200':
          description: Razorpay subscription authorization verified
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VerifyRazorpaySubscriptionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /api/payments/razorpay/{environment}/subscriptions/{subscriptionId}/cancel:
    post:
      summary: Cancel Razorpay Subscription
      description: Cancel a Razorpay subscription after evaluating the caller's UPDATE policy on payments.razorpay_subscriptions.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      - $ref: '#/components/parameters/RazorpaySubscriptionIdPath'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelRazorpaySubscriptionBody'
            example:
              cancelAtCycleEnd: true
      responses:
        '200':
          description: Razorpay subscription cancelled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelRazorpaySubscriptionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /api/payments/razorpay/{environment}/subscriptions/{subscriptionId}/pause:
    post:
      summary: Pause Razorpay Subscription
      description: Pause a Razorpay subscription immediately after evaluating the caller's UPDATE policy on payments.razorpay_subscriptions.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      - $ref: '#/components/parameters/RazorpaySubscriptionIdPath'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PauseRazorpaySubscriptionBody'
      responses:
        '200':
          description: Razorpay subscription paused
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PauseRazorpaySubscriptionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /api/payments/razorpay/{environment}/subscriptions/{subscriptionId}/resume:
    post:
      summary: Resume Razorpay Subscription
      description: Resume a paused Razorpay subscription immediately after evaluating the caller's UPDATE policy on payments.razorpay_subscriptions.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      - $ref: '#/components/parameters/RazorpaySubscriptionIdPath'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResumeRazorpaySubscriptionBody'
      responses:
        '200':
          description: Razorpay subscription resumed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResumeRazorpaySubscriptionResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
  /api/payments/razorpay/{environment}/customers:
    get:
      summary: List Razorpay Customers
      description: Admin/debug read for mirrored Razorpay customers. This is a display mirror only and should not replace app-owned billing tables.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      - $ref: '#/components/parameters/LimitQuery'
      responses:
        '200':
          description: Razorpay customers
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListPaymentCustomersResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
  /api/payments/razorpay/{environment}/transactions:
    get:
      summary: List Razorpay Transactions
      description: Admin/debug read for InsForge's Razorpay transaction projection. Use app-owned fulfillment tables with RLS for end-user order, credit, or entitlement state.
      tags:
      - Razorpay Payments
      security:
      - bearerAuth: []
      - apiKey: []
      parameters:
      - $ref: '#/components/parameters/EnvironmentPath'
      - $ref: '#/components/parameters/SubjectTypeQuery'
      - $ref: '#/components/parameters/SubjectIdQuery'
      - $ref: '#/components/parameters/LimitQuery'
      responses:
        '200':
          description: Razorpay transactions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListPaymentTransactionsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    UpsertRazorpayConfigBody:
      type: object
      required:
      - keyId
      - keySecret
      additionalProperties: false
      properties:
        keyId:
          type: string
          minLength: 1
          example: rzp_test_xxx
        keySecret:
          type: string
          minLength: 1
          writeOnly: true
          example: razorpay_secret_xxx
        webhookSecret:
          type: string
          writeOnly: true
          example: webhook_secret_xxx
    RazorpayLatestSyncStatus:
      type: string
      enum:
      - succeeded
      - failed
    PaymentProvider:
      type: string
      enum:
      - stripe
      - razorpay
    ListPaymentCustomersResponse:
      type: object
      required:
      - customers
      properties:
        customers:
          type: array
          items:
            $ref: '#/components/schemas/PaymentCustomerListItem'
    UpdateRazorpayItemBody:
      type: object
      minProperties: 1
      additionalProperties: false
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        description:
          type: string
          nullable: true
          maxLength: 2048
        amount:
          type: integer
          minimum: 1
        currency:
          type: string
          minLength: 3
          maxLength: 3
          example: INR
        active:
          type: boolean
    PaymentTransaction:
      type: object
      required:
      - environment
      - provider
      - type
      - status
      - subjectType
      - subjectId
      - providerCustomerId
      - customerEmailSnapshot
      - providerReferenceId
      - providerReferenceType
      - amount
      - amountRefunded
      - currency
      - description
      - paidAt
      - failedAt
      - refundedAt
      - providerCreatedAt
      - createdAt
      - updatedAt
      properties:
        environment:
          $ref: '#/components/schemas/PaymentEnvironment'
        provider:
          $ref: '#/components/schemas/PaymentProvider'
        type:
          $ref: '#/components/schemas/PaymentTransactionType'
        status:
          $ref: '#/components/schemas/PaymentTransactionStatus'
        subjectType:
          type: string
          nullable: true
        subjectId:
          type: string
          nullable: true
        providerCustomerId:
          type: string
          nullable: true
          example: cus_123
        customerEmailSnapshot:
          type: string
          format: email
          nullable: true
        providerReferenceId:
          type: string
          nullable: true
          example: pi_123
        providerReferenceType:
          type: string
          nullable: true
          example: payment_intent
        amount:
          type: integer
          nullable: true
          example: 2900
        amountRefunded:
          type: integer
          nullable: true
          example: 0
        currency:
          type: string
          nullable: true
          example: usd
        description:
          type: string
          nullable: true
        paidAt:
          type: string
          format: date-time
          nullable: true
        failedAt:
          type: string
          format: date-time
          nullable: true
        refundedAt:
          type: string
          format: date-time
          nullable: true
        providerCreatedAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    CreateRazorpaySubscriptionResponse:
      type: object
      required:
      - subscription
      - checkoutOptions
      properties:
        subscription:
          $ref: '#/components/schemas/RazorpaySubscription'
        checkoutOptions:
          type: object
          required:
          - key
          - subscription_id
          - prefill
          additionalProperties: false
          properties:
            key:
              type: string
              example: rzp_test_xxx
            subscription_id:
              type: string
              example: sub_123
            name:
              type: string
              nullable: true
            description:
              type: string
              nullable: true
            callback_url:
              type: string
              nullable: true
            prefill:
              $ref: '#/components/schemas/RazorpayCheckoutPrefill'
    GetRazorpayStatusResponse:
      type: object
      required:
      - razorpayConnections
      properties:
        razorpayConnections:
          type: array
          items:
            $ref: '#/components/schemas/RazorpayConnection'
    PauseRazorpaySubscriptionResponse:
      type: object
      required:
      - subscription
      properties:
        subscription:
          $ref: '#/components/schemas/RazorpaySubscription'
    CancelRazorpaySubscriptionResponse:
      type: object
      required:
      - subscription
      properties:
        subscription:
          $ref: '#/components/schemas/RazorpaySubscription'
    RazorpayItem:
      type: object
      required:
      - environment
      - itemId
      - name
      - description
      - active
      - amount
      - unitAmount
      - currency
      - type
      - providerCreatedAt
      - syncedAt
      properties:
        environment:
          $ref: '#/components/schemas/RazorpayEnvironment'
        itemId:
          type: string
          example: item_123
        name:
          type: string
          example: Pro monthly
        description:
          type: string
          nullable: true
        active:
          type: boolean
        amount:
          type: integer
          nullable: true
          example: 290000
        unitAmount:
          type: integer
          nullable: true
          description: Razorpay per-unit amount mirror. Usually equals amount for catalog items.
          example: 290000
        currency:
          type: string
          example: inr
        type:
          type: string
          nullable: true
          example: invoice
        providerCreatedAt:
          type: string
          format: date-time
          nullable: true
        syncedAt:
          type: string
          format: date-time
    SyncRazorpayPaymentsEnvironmentResult:
      type: object
      required:
      - environment
      - status
      - connection
      - syncCounts
      - error
      additionalProperties: false
      properties:
        environment:
          $ref: '#/components/schemas/RazorpayEnvironment'
        status:
          type: string
          enum:
          - succeeded
          - failed
        connection:
          $ref: '#/components/schemas/RazorpayConnection'
        syncCounts:
          $ref: '#/components/schemas/RazorpaySyncCounts'
        error:
          type: string
          nullable: true
    CreateRazorpayOrderResponse:
      type: object
      required:
      - order
      - checkoutOptions
      properties:
        order:
          $ref: '#/components/schemas/RazorpayOrder'
        checkoutOptions:
          type: object
          required:
          - key
          - amount
          - currency
          - order_id
          - prefill
          additionalProperties: false
          properties:
            key:
              type: string
              example: rzp_test_xxx
            amount:
              type: integer
              minimum: 1
            currency:
              type: string
              example: INR
            order_id:
              type: string
              example: order_123
            name:
              type: string
              nullable: true
            description:
              type: string
              nullable: true
            callback_url:
              type: string
              nullable: true
            prefill:
              $ref: '#/components/schemas/RazorpayCheckoutPrefill'
    CreateRazorpayOrderBody:
      type: object
      required:
      - amount
      - currency
      additionalProperties: false
      description: Notes keys starting with insforge_ are reserved and rejected.
      properties:
        amount:
          type: integer
          minimum: 1
          example: 50000
        currency:
          type: string
          minLength: 3
          maxLength: 3
          example: INR
        receipt:
          type: string
          nullable: true
          minLength: 1
          maxLength: 40
        description:
          type: string
          nullable: true
          maxLength: 2048
        subject:
          $ref: '#/components/schemas/BillingSubject'
        customerName:
          type: string
          nullable: true
          minLength: 1
          maxLength: 255
        customerEmail:
          type: string
          format: email
          nullable: true
        customerContact:
          type: string
          nullable: true
          minLength: 1
          maxLength: 32
        callbackUrl:
          type: string
          format: uri
          nullable: true
        notes:
          description: Native Razorpay notes. Use stable app identifiers such as `order_id` for webhook fulfillment triggers.
          allOf:
          - $ref: '#/components/schemas/Metadata'
    PaymentTransactionStatus:
      type: string
      enum:
      - succeeded
      - failed
      - pending
      - refunded
      - partially_refunded
    RazorpayConnection:
      type: object
      required:
      - environment
      - status
      - accountId
      - merchantName
      - accountLivemode
      - webhookEndpointId
      - webhookEndpointUrl
      - webhookConfiguredAt
      - maskedKey
      - l

# --- truncated at 32 KB (54 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/insforge/refs/heads/main/openapi/insforge-razorpay-payments-api-openapi.yml