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

# Create a payment intent

> Creates a new payment intent for a customer to purchase a plan. Requires an idempotency key to prevent duplicate charges. Returns client secret and publishable key needed for frontend integration.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/sdk/payment-intents
openapi: 3.0.0
info:
  contact: {}
  description: The SolvaPay REST API specification
  title: SolvaPay REST API
  version: '1.0'
servers: []
security: []
tags: []
paths:
  /v1/sdk/payment-intents:
    post:
      tags:
        - Payment Intents
      summary: Create a payment intent
      description: >-
        Creates a new payment intent for a customer to purchase a plan. Requires
        an idempotency key to prevent duplicate charges. Returns client secret
        and publishable key needed for frontend integration.
      operationId: PaymentIntentSdkController_createPaymentIntent
      parameters:
        - description: Unique idempotency key to prevent duplicate payments (required)
          in: header
          name: idempotency-key
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentIntentDto'
        description: Payment intent creation data
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                example:
                  amount: 4999
                  clientSecret: pi_1a2b3c4d5e6f7g8h_secret_AbCdEf123456
                  createdAt: '2025-10-18T10:30:00.000Z'
                  currency: usd
                  customerRef: cus_3c4d5e6f7g8h
                  exchangeRate: 1
                  expiresAt: '2025-10-19T10:30:00.000Z'
                  originalAmount: 4999
                  planRef: pln_2b3c4d5e6f7g
                  processorPaymentId: pi_1a2b3c4d5e6f7g8h
                  publishableKey: pk_test_...
                  status: requires_payment_method
          description: Payment intent created successfully
        '400':
          content:
            application/json:
              schema:
                example:
                  error: Bad Request
                  message: idempotency-key header is required
                  statusCode: 400
          description: Missing required fields or invalid data
      security:
        - SecretKey: []
components:
  schemas:
    CreatePaymentIntentDto:
      properties:
        amount:
          exclusiveMaximum: false
          exclusiveMinimum: false
          maximum: 10000000
          minimum: 100
          type: integer
        currency:
          type: string
        customerRef:
          minLength: 1
          type: string
        description:
          maxLength: 500
          type: string
        planRef:
          minLength: 1
          type: string
        pricingTier:
          type: string
        productRef:
          minLength: 1
          type: string
        purpose:
          default: product
          enum:
            - product
            - credit_topup
            - usage_billing
          type: string
      required:
        - customerRef
      type: object

````