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

# Create



## OpenAPI

````yaml POST /payment-method
openapi: 3.1.0
info:
  title: Compago API
  version: 1.0.0
  description: >-
    Public and private API endpoints for Compago's payment infrastructure. This
    specification currently includes endpoints for one-time payments. More
    endpoints will be added as the platform evolves.
servers:
  - url: https://demo.api.harmony.compago.com/api
  - url: https://api.harmony.compago.com/api
security: []
tags:
  - name: OneTimePayment
    description: Endpoints for creating and processing one-time payment links
  - name: PaymentMethod
    description: >-
      Endpoints for saving cards, charging saved payment methods, and processing
      refunds
  - name: PaymentIntent
    description: >-
      Endpoints for creating and managing card-present payment intents for POS
      terminal integrations
paths:
  /payment-method:
    post:
      tags:
        - PaymentMethod
      summary: Create a payment method
      operationId: createPaymentMethod
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePaymentMethodRequest'
      responses:
        '200':
          description: Payment method created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePaymentMethodResponse'
        '400':
          description: Invalid request or missing organization context
        '401':
          description: Unauthorized – missing or invalid API key
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CreatePaymentMethodRequest:
      type: object
      description: >-
        Request body for creating a payment method. The customer will be
        directed to the checkout URL to securely save their card. A small
        verification charge is placed and then voided to validate the card.
      properties:
        externalId:
          type: string
          example: customer_12345
          description: Optional external ID to track the payment method in your system.
        verificationAmount:
          type: number
          format: decimal
          minimum: 0.01
          default: 1
          example: 1
          description: >-
            Amount in MXN used for the verification charge. This charge is
            placed and then voided. Defaults to $1 MXN.
        billingInformation:
          $ref: '#/components/schemas/PaymentMethodBillingInformation'
        displayMode:
          type: string
          enum:
            - LINK
            - EMBEDDED
          default: LINK
          description: >-
            How the checkout is displayed. LINK redirects the customer to a
            full-page checkout. EMBEDDED allows embedding in an iframe.
        buttonText:
          type: string
          description: Custom text for the checkout button (EMBEDDED mode only).
        buttonColor:
          type: string
          description: Custom hex color for the checkout button (EMBEDDED mode only).
        redirectUrl:
          type: string
          format: uri
          example: https://yourstore.com/cards/saved
          description: >-
            URL where the customer is redirected after successfully saving their
            card. Compago appends `id` and `externalId` as query parameters.
        ttlMinutes:
          type: integer
          minimum: 1
          default: 2880
          example: 2880
          description: >-
            Time-to-live in minutes for the checkout link. Defaults to 2,880
            minutes (48 hours).
      required:
        - billingInformation
    CreatePaymentMethodResponse:
      type: object
      description: Response after creating a payment method
      properties:
        id:
          type: string
          format: uuid
          example: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
          description: Unique identifier of the payment method
        checkoutUrl:
          type: string
          format: uri
          description: URL where the customer completes the card saving process
      required:
        - id
        - checkoutUrl
    PaymentMethodBillingInformation:
      type: object
      description: Billing information for the payment method
      properties:
        email:
          type: string
          format: email
          example: maria.gonzalez@example.com
          description: Customer's email address
        firstName:
          type: string
          example: María
          description: Customer's first name
        lastName:
          type: string
          example: González
          description: Customer's last name
        phoneNumber:
          type: string
          example: '+5215512345678'
          description: Customer's phone number
      required:
        - email
        - firstName
        - lastName
        - phoneNumber
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````