{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/curlec/json-schema/curlec-payment-schema.json",
  "title": "Payment",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/curlec-orders-api-openapi.yml#/components/schemas/Payment",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique payment identifier. Prefix: pay_"
    },
    "entity": {
      "type": "string",
      "enum": [
        "payment"
      ]
    },
    "amount": {
      "type": "integer",
      "description": "Payment amount in paise."
    },
    "currency": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "created",
        "authorized",
        "captured",
        "refunded",
        "failed"
      ],
      "description": "created: initiated. authorized: bank approved, not yet captured. captured: funds collected. refunded: fully refunded. failed: transaction failed."
    },
    "order_id": {
      "type": "string",
      "description": "Associated order ID (order_*)."
    },
    "invoice_id": {
      "type": "string"
    },
    "international": {
      "type": "boolean"
    },
    "method": {
      "type": "string",
      "enum": [
        "card",
        "netbanking",
        "wallet",
        "emi",
        "upi"
      ]
    },
    "amount_refunded": {
      "type": "integer",
      "description": "Total refunded amount in paise."
    },
    "refund_status": {
      "type": "string",
      "enum": [
        "null",
        "partial",
        "full"
      ]
    },
    "captured": {
      "type": "boolean"
    },
    "description": {
      "type": "string"
    },
    "card_id": {
      "type": "string"
    },
    "card": {
      "$ref": "#/$defs/CardDetails"
    },
    "bank": {
      "type": "string",
      "description": "Bank code for netbanking. Example: HDFC."
    },
    "wallet": {
      "type": "string",
      "description": "Wallet name. Examples: paytm, mobikwik."
    },
    "vpa": {
      "type": "string"
    },
    "upi": {
      "$ref": "#/$defs/UpiDetails"
    },
    "email": {
      "type": "string"
    },
    "contact": {
      "type": "string"
    },
    "customer_id": {
      "type": "string"
    },
    "token_id": {
      "type": "string"
    },
    "notes": {
      "$ref": "#/$defs/Notes"
    },
    "fee": {
      "type": "integer",
      "description": "Razorpay fee charged (paise)."
    },
    "tax": {
      "type": "integer",
      "description": "GST on the fee (paise)."
    },
    "error_code": {
      "type": "string"
    },
    "error_description": {
      "type": "string"
    },
    "error_source": {
      "type": "string"
    },
    "error_step": {
      "type": "string"
    },
    "error_reason": {
      "type": "string"
    },
    "acquirer_data": {
      "$ref": "#/$defs/AcquirerData"
    },
    "created_at": {
      "type": "integer"
    }
  },
  "$defs": {
    "AcquirerData": {
      "type": "object",
      "properties": {
        "rrn": {
          "type": "string",
          "description": "Bank RRN (Retrieval Reference Number)."
        },
        "authentication_reference_number": {
          "type": "string"
        },
        "bank_transaction_id": {
          "type": "string"
        },
        "transaction_id": {
          "type": "string"
        }
      }
    },
    "CardDetails": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Card token identifier (card_*)."
        },
        "entity": {
          "type": "string"
        },
        "name": {
          "type": "string",
          "description": "Cardholder name."
        },
        "last4": {
          "type": "string",
          "description": "Last 4 digits of the card number."
        },
        "network": {
          "type": "string",
          "description": "Card network. Examples: Visa, MasterCard, RuPay, Amex."
        },
        "type": {
          "type": "string",
          "description": "Card type: credit or debit."
        },
        "issuer": {
          "type": "string",
          "description": "4-character code of the issuing bank."
        },
        "emi": {
          "type": "boolean",
          "description": "Whether EMI is available on this card."
        },
        "sub_type": {
          "type": "string",
          "description": "Card sub-type (e.g. consumer, corporate)."
        }
      }
    },
    "Notes": {
      "type": "object",
      "description": "Key-value pairs for storing custom metadata. Maximum 15 pairs. Each key and value must not exceed 256 characters.",
      "additionalProperties": {
        "type": "string"
      },
      "maxProperties": 15
    },
    "UpiDetails": {
      "type": "object",
      "properties": {
        "payer_account_type": {
          "type": "string"
        },
        "vpa": {
          "type": "string",
          "description": "Customer UPI VPA (Virtual Payment Address). Example: user@upi."
        },
        "flow": {
          "type": "string",
          "description": "UPI flow used: collect, intent, or in_app."
        }
      }
    }
  }
}