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

# Sync Razorpay Payments State For One Environment

> Sync items, plans, customers, subscriptions, invoices, and payments for one Razorpay environment. Razorpay remains the source of truth.



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/payments.yaml post /api/payments/razorpay/{environment}/sync
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/razorpay/{environment}/sync:
    post:
      tags:
        - Razorpay Payments
      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.
      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'
      security:
        - bearerAuth: []
        - apiKey: []
components:
  parameters:
    EnvironmentPath:
      name: environment
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/PaymentEnvironment'
      description: Payment provider environment.
  schemas:
    SyncRazorpayPaymentsResponse:
      type: object
      required:
        - results
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/SyncRazorpayPaymentsEnvironmentResult'
    PaymentEnvironment:
      type: string
      enum:
        - test
        - live
    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
    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
    RazorpayEnvironment:
      $ref: '#/components/schemas/PaymentEnvironment'
    RazorpayConnection:
      type: object
      required:
        - environment
        - status
        - accountId
        - merchantName
        - accountLivemode
        - webhookEndpointId
        - webhookEndpointUrl
        - webhookConfiguredAt
        - maskedKey
        - lastSyncedAt
        - lastSyncStatus
        - lastSyncError
        - lastSyncCounts
      properties:
        environment:
          $ref: '#/components/schemas/RazorpayEnvironment'
        status:
          $ref: '#/components/schemas/RazorpayConnectionStatus'
        accountId:
          type: string
          nullable: true
          example: acc_123
        merchantName:
          type: string
          nullable: true
          example: Example Merchant
        accountLivemode:
          type: boolean
          nullable: true
        webhookEndpointId:
          type: string
          nullable: true
          example: manual
        webhookEndpointUrl:
          type: string
          nullable: true
          example: https://api.example.com/api/webhooks/razorpay/test
        webhookConfiguredAt:
          type: string
          format: date-time
          nullable: true
        maskedKey:
          type: string
          nullable: true
          example: rzp_test_...abcd
        lastSyncedAt:
          type: string
          format: date-time
          nullable: true
        lastSyncStatus:
          allOf:
            - $ref: '#/components/schemas/RazorpayLatestSyncStatus'
          nullable: true
        lastSyncError:
          type: string
          nullable: true
        lastSyncCounts:
          type: object
          additionalProperties:
            type: number
    RazorpaySyncCounts:
      type: object
      required:
        - plans
        - items
        - customers
        - subscriptions
        - invoices
        - payments
      additionalProperties: false
      properties:
        plans:
          type: integer
          minimum: 0
        items:
          type: integer
          minimum: 0
        customers:
          type: integer
          minimum: 0
        subscriptions:
          type: integer
          minimum: 0
        invoices:
          type: integer
          minimum: 0
        payments:
          type: integer
          minimum: 0
    RazorpayConnectionStatus:
      type: string
      enum:
        - unconfigured
        - connected
        - error
    RazorpayLatestSyncStatus:
      type: string
      enum:
        - succeeded
        - failed
  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

````