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

# Process a card payment

> Receives a payment payload and routes it through the Orchestrator Smart Routing system.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/payments/card
openapi: 3.0.0
info:
  title: PlugToPay API
  description: API to make payments easy in multiple gateways.
  version: 1.0.0
servers:
  - url: http://localhost:7701
    description: Test Server
security: []
paths:
  /api/v1/payments/card:
    post:
      tags:
        - Payments
      summary: Process a card payment
      description: >-
        Receives a payment payload and routes it through the Orchestrator Smart
        Routing system.
      operationId: 4bf65d67124d9307fdc245ece42bdf4a
      parameters:
        - $ref: '#/components/parameters/XClientId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              required:
                - merchant_order_id
                - amount
                - currency
                - payment_method
                - customer
              properties:
                merchant_order_id:
                  description: Your internal order reference (1–100 chars).
                  type: string
                  example: ORD-2026-12345
                amount:
                  description: Amount in cents (R$1,00 minimum = 100)
                  type: integer
                  example: 15000
                currency:
                  description: 3-letter ISO currency code.
                  type: string
                  example: BRL
                payment_method:
                  type: string
                  enum:
                    - card
                    - pix
                    - billet
                  example: card
                gateway_first_try:
                  description: >-
                    Gateway slug to attempt first. Falls back to routing rules
                    if not set or gateway not enabled.
                  type: string
                  enum:
                    - pagarme
                    - picpay
                    - safe2pay
                    - pagbank
                    - stripe
                    - asaas
                    - erede
                  example: pagarme
                  nullable: true
                customer:
                  description: >-
                    Identify by token (existing customer) or by name + email +
                    document (new customer).
                  properties:
                    token:
                      description: >-
                        Existing customer token. Mutually exclusive with
                        name/email/document.
                      type: string
                      example: cus_token_abc123
                      nullable: true
                    name:
                      description: Required when no customer token.
                      type: string
                      example: John Doe
                    email:
                      description: Required when no customer token.
                      type: string
                      example: john.doe@example.com
                    document:
                      description: >-
                        CPF (11 digits) or CNPJ (14 digits). Optional when token
                        is provided.
                      type: string
                      example: '12345678909'
                    phone:
                      description: DDD + 9-digit mobile number.
                      type: string
                      example: '11912345678'
                      nullable: true
                  type: object
                card:
                  description: >-
                    Required when payment_method is card. Provide either token
                    or raw card fields.
                  properties:
                    token:
                      description: >-
                        Internal vault card token. When provided, raw card
                        fields are not required.
                      type: string
                      example: card_tok_xyz
                      nullable: true
                    number:
                      description: Required without token.
                      type: string
                      example: '4111111111111111'
                    cvv:
                      description: Required without token.
                      type: string
                      example: '123'
                    expiration_month:
                      description: MM format (01–12). Required without token.
                      type: string
                      example: '12'
                    expiration_year:
                      description: YYYY format. Required without token.
                      type: string
                      example: '2028'
                    holder:
                      description: Cardholder name as printed. Required without token.
                      type: string
                      example: JOHN DOE
                    holder_document:
                      description: Cardholder CPF/CNPJ. Required without token.
                      type: string
                      example: '12345678909'
                    holder_birthdate:
                      description: YYYY-MM-DD. Required without token.
                      type: string
                      example: '1990-05-20'
                    holder_phone:
                      description: DDD + 9-digit mobile. Required without token.
                      type: string
                      example: '11912345678'
                    installments:
                      description: 1–12. Required without token.
                      type: integer
                      example: 1
                    save_card:
                      description: >-
                        When true, card is stored in the vault for future
                        charges.
                      type: boolean
                      example: false
                  type: object
                  nullable: true
                billing_address:
                  description: Required when no card.token is provided.
                  properties:
                    street:
                      type: string
                      example: Rua das Flores
                    number:
                      type: string
                      example: '123'
                    neighborhood:
                      type: string
                      example: Centro
                    zip_code:
                      description: 8 digits, numbers only.
                      type: string
                      example: '01310100'
                    city:
                      type: string
                      example: São Paulo
                    state:
                      description: 2-letter state code.
                      type: string
                      example: SP
                    country:
                      type: string
                      example: BR
                  type: object
                  nullable: true
                splits:
                  description: >-
                    Optional split rules. Each entry directs a portion of the
                    amount to a sub-account.
                  type: array
                  items:
                    required:
                      - subaccount_id
                      - amount
                    properties:
                      subaccount_id:
                        type: string
                        example: sub_abc123
                      amount:
                        description: Amount in cents to split to this sub-account.
                        type: integer
                        example: 5000
                    type: object
                  nullable: true
              type: object
      responses:
        '201':
          description: Payment processed successfully
          content:
            application/json:
              schema:
                properties:
                  status:
                    type: string
                    enum:
                      - approved
                      - failed
                      - pending
                    example: approved
                  transaction_id:
                    type: string
                    example: 01hvxyz...
                  amount:
                    type: integer
                    example: 15000
                  message:
                    type: string
                    example: Payment approved.
                  attempts:
                    type: integer
                    example: 1
                  payment_method:
                    type: string
                    example: card
                  merchant_order_id:
                    type: string
                    example: ORD-2026-12345
                    nullable: true
                  idempotency_key:
                    type: string
                    example: order-abc-123
                    nullable: true
                  plugtopay_request_time:
                    type: string
                    example: 0.05s
                    nullable: true
                  total_request_time:
                    type: string
                    example: 0.8s
                    nullable: true
                  gateways_request_time:
                    type: string
                    example: 0.75s
                    nullable: true
                  created_at:
                    type: string
                    format: date-time
                    nullable: true
                  updated_at:
                    type: string
                    format: date-time
                    nullable: true
                  transactions:
                    type: array
                    items:
                      type: object
                  customer:
                    type: object
                    nullable: true
                  webhook:
                    type: object
                    nullable: true
                  card:
                    description: >-
                      Present when payment_method is card and status is not
                      processing.
                    properties:
                      response_code:
                        type: string
                        nullable: true
                      soft_descriptor:
                        type: string
                        nullable: true
                      authorization_nsu:
                        type: string
                        nullable: true
                      gateway_message:
                        type: string
                        nullable: true
                    type: object
                    nullable: true
                type: object
        '202':
          description: >-
            Accepted — gateway did not respond within the configured timeout,
            processing continues in background
          content:
            application/json:
              schema:
                properties:
                  status:
                    type: string
                    example: processing
                  transaction_id:
                    type: string
                    example: 01hvxyz...
                    nullable: true
                  amount:
                    type: integer
                    example: 15000
                    nullable: true
                  message:
                    type: string
                    example: >-
                      The payment is being processed, a webhook will be sent to
                      you later.
                type: object
        '401':
          description: Unauthorized — Invalid API Key
        '422':
          description: Validation Error
        '500':
          description: Gateway or internal error
      security:
        - ApiKeyAuth: []
components:
  parameters:
    XClientId:
      name: x-client-id
      in: header
      description: Client identifier for the company in the request.
      required: true
      schema:
        type: string
        example: client_abc123
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Company API key. Send in the X-API-Key header.
      name: X-API-Key
      in: header

````