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

# Create a payment

> Creates a pending payment and returns a hosted checkout URL.
The settlement wallet and Stellar network are resolved from your organization settings.




## OpenAPI

````yaml /openapi/v1.yaml post /payments
openapi: 3.1.0
info:
  title: Payoes API
  version: 1.0.0
  description: >
    REST API for creating and managing Stellar payments, customers, checkout
    sessions,

    payment links, and invoices.


    ## Authentication


    Send your API key as a Bearer token. Sandbox keys use the `pk_test_` prefix
    and

    only access sandbox data. Live keys use `pk_live_` and only access
    production data.


    ## Environments


    Sandbox and production are fully isolated. Resources created in one
    environment

    are not visible from API keys scoped to the other.
servers:
  - url: https://payoes.com/api/v1
    description: Production host (replace with your deployment URL)
  - url: http://localhost:3000/api/v1
    description: Local development
security:
  - bearerAuth: []
tags:
  - name: Payments
    description: Direct payment intents with hosted Stellar checkout
  - name: Customers
    description: Payer profiles scoped to your organization and environment
  - name: Checkout sessions
    description: Hosted checkout flows with optional redirect URLs
  - name: Payment links
    description: Reusable shareable links that start checkout on each visit
  - name: Invoices
    description: Customer invoices with draft, finalize, and checkout lifecycle
paths:
  /payments:
    post:
      tags:
        - Payments
      summary: Create a payment
      description: >
        Creates a pending payment and returns a hosted checkout URL.

        The settlement wallet and Stellar network are resolved from your
        organization settings.
      operationId: createPayment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentRequest'
      responses:
        '201':
          description: Payment created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Payment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    CreatePaymentRequest:
      type: object
      required:
        - amount
      properties:
        amount:
          $ref: '#/components/schemas/StellarAmount'
        settlement_asset:
          $ref: '#/components/schemas/AssetRef'
          description: Optional. Defaults to the organization settlement asset.
        allowed_assets:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/AssetRef'
          description: Optional. Defaults to all enabled organization assets.
        description:
          type: string
          maxLength: 500
          nullable: true
        metadata:
          $ref: '#/components/schemas/StringMetadata'
        expires_in_minutes:
          type: integer
          minimum: 5
          maximum: 10080
          description: Minutes until the payment expires (default 60)
        customer_id:
          type: string
          nullable: true
          description: Customer public ID to link before checkout
    Payment:
      type: object
      required:
        - id
        - object
        - amount
        - settlement_asset
        - allowed_assets
        - status
        - checkout_url
        - created_at
      properties:
        id:
          type: string
          example: pay_nLU2gUDk-v3tdyd6
        object:
          type: string
          enum:
            - payment_intent
        amount:
          type: string
          example: '2.0000000'
        settlement_asset:
          $ref: '#/components/schemas/AssetRef'
        allowed_assets:
          type: array
          items:
            $ref: '#/components/schemas/AssetRef'
        paid_asset:
          allOf:
            - $ref: '#/components/schemas/AssetRef'
          nullable: true
          description: Asset the customer actually paid with (set after checkout)
        status:
          $ref: '#/components/schemas/PaymentStatus'
        description:
          type: string
          nullable: true
        metadata:
          $ref: '#/components/schemas/StringMetadata'
        checkout_url:
          type: string
          format: uri
        source_type:
          $ref: '#/components/schemas/PaymentSourceType'
        customer_id:
          type: string
          nullable: true
        payer_address:
          type: string
          nullable: true
        tx_hash:
          type: string
          nullable: true
        confirmed_at:
          type: string
          format: date-time
          nullable: true
        expires_at:
          type: string
          format: date-time
          nullable: true
        created_at:
          type: string
          format: date-time
    StellarAmount:
      type: string
      description: Stellar amount with up to 7 decimal places
      pattern: ^\d+(\.\d{1,7})?$
      example: '10.5'
    AssetRef:
      type: object
      required:
        - asset_code
      properties:
        asset_code:
          type: string
          description: Stellar asset code (1–12 alphanumeric characters, or XLM)
          example: USDC
        issuer_address:
          type: string
          nullable: true
          description: Issuer public key for credit assets. Null for XLM.
    StringMetadata:
      type: object
      additionalProperties:
        type: string
      nullable: true
    PaymentStatus:
      type: string
      enum:
        - pending
        - completed
        - failed
        - expired
    PaymentSourceType:
      type: string
      enum:
        - direct
        - checkout_session
        - payment_link
        - invoice
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
  responses:
    BadRequest:
      description: Invalid request body or business rule violation
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Settlement wallet is not configured
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Unauthorized
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key from the Payoes dashboard (`pk_test_...` or `pk_live_...`)

````