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

# Create a payment

> Create a hosted checkout. Amount is integer USDC base units (1000000 = 1 USDC). Requires an active Arc USDC settlement wallet. Retain the idempotency key and identical request for retries.



## OpenAPI

````yaml /openapi.json post /api/v1/payments/
openapi: 3.0.3
info:
  title: goChameleon Merchant API
  version: 1.0.0
  description: Create hosted USDC payments on Arc and check their status.
servers:
  - url: https://sandbox-api.gochameleon.xyz
    description: Sandbox — test keys
  - url: https://api.gochameleon.xyz
    description: Production — live keys
security:
  - merchantKey: []
paths:
  /api/v1/payments/:
    post:
      tags:
        - Payments
      summary: Create a payment
      description: >-
        Create a hosted checkout. Amount is integer USDC base units (1000000 = 1
        USDC). Requires an active Arc USDC settlement wallet. Retain the
        idempotency key and identical request for retries.
      operationId: root_create
      parameters:
        - in: header
          name: Idempotency-Key
          schema:
            type: string
            pattern: ^[A-Za-z0-9_-]{16,128}$
            minLength: 16
            maxLength: 128
          required: true
          example: order_example_000001
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentRequest'
            example:
              amount: 1000000
              currency: USDC
              reference: order-000001
              metadata:
                order_id: '000001'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePaymentResponse'
          description: Existing payment returned for an identical retry
          headers:
            Idempotency-Replayed:
              description: true for an identical retry; false for a new payment
              schema:
                type: string
                enum:
                  - 'true'
                  - 'false'
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePaymentResponse'
          description: New payment created
          headers:
            Idempotency-Replayed:
              description: true for an identical retry; false for a new payment
              schema:
                type: string
                enum:
                  - 'true'
                  - 'false'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '403':
          description: Access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '409':
          description: Idempotency conflict or settlement wallet required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIError'
      security:
        - merchantKey: []
components:
  schemas:
    CreatePaymentRequest:
      type: object
      properties:
        amount:
          type: integer
          maximum: 9000000000000000
          minimum: 1
          format: int64
          description: 'Integer USDC base units: 1000000 = 1 USDC.'
        currency:
          $ref: '#/components/schemas/CurrencyEnum'
        reference:
          type: string
          default: ''
          maxLength: 64
        metadata:
          type: object
          additionalProperties: true
          description: Private JSON object, at most 16 KiB, with finite numbers.
        success_url:
          type: string
          format: uri
          default: ''
          maxLength: 2000
          description: >-
            Optional HTTPS return URL without embedded credentials. Returning is
            not proof of payment.
        cancel_url:
          type: string
          format: uri
          default: ''
          maxLength: 2000
          description: >-
            Optional HTTPS return URL without embedded credentials. Returning is
            not proof of payment.
      required:
        - amount
        - currency
      additionalProperties: false
    CreatePaymentResponse:
      type: object
      properties:
        id:
          type: string
        amount:
          type: integer
        currency:
          type: string
        reference:
          type: string
        metadata: {}
        status:
          type: string
        checkout_url:
          type: string
          format: uri
        expires_at:
          type: string
          format: date-time
        livemode:
          type: boolean
      required:
        - amount
        - checkout_url
        - currency
        - expires_at
        - id
        - livemode
        - metadata
        - reference
        - status
    APIError:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        details:
          nullable: true
        request_id:
          type: string
          nullable: true
    CurrencyEnum:
      enum:
        - USDC
      type: string
      description: '* `USDC` - USDC'
  securitySchemes:
    merchantKey:
      type: http
      scheme: bearer
      bearerFormat: Organization API key
      description: Use gck_test_ keys on sandbox and gck_live_ keys on production.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.