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

# Add Card to Customer

> Adds a card to a customer. The behaviour depends on `payin_type`:

- `DCP`, `DCP_AUTH`: tokenizes a card. The response includes a `tokenization_link` the customer must visit to enter the card details.
- `STRIPE`: issues a virtual card against `wallet_id`. See [Stripe Authorization](/guides/stripe-authorization).
- `M2P_ISSUING` (only when card issuing is enabled): issues a card linked to a wallet previously created with `POST /wallets` and `type: M2P_ISSUING`. Issuance is asynchronous: the card is returned with `confirmed: false` and becomes `confirmed: true`, with the issuer token in `gateway_reference_id`, once the issuer confirms it.




## OpenAPI

````yaml POST /customers/{uuid}/cards
openapi: 3.1.0
info:
  title: Truust API
  version: '2.0'
  description: >
    The Truust API allows you to manage payment flows, orders, customers,
    wallets, and more.


    ## Authentication


    All authenticated endpoints require a Bearer token using your account's
    **Secret Key**.


    ```

    Authorization: Bearer {your_secret_key}

    ```


    Your API keys are available in the Dashboard under **Account Settings → API
    Developers**.
  contact:
    email: hello@truust.io
  license:
    name: Proprietary
servers:
  - url: https://{subdomain}.truust.io/2.0
    description: Production
    variables:
      subdomain:
        default: your-subdomain
        description: Your account subdomain
  - url: https://{subdomain}-sandbox.truust.io/2.0
    description: Sandbox
    variables:
      subdomain:
        default: your-subdomain
        description: Your account subdomain
security:
  - bearerAuth: []
tags:
  - name: Account
    description: Manage your Truust account
  - name: Customers
    description: Manage buyers and sellers (end users)
  - name: Orders
    description: Create and manage escrow payment orders
  - name: Payins
    description: Manage incoming payments for orders
  - name: Payouts
    description: Manage outgoing payments from orders
  - name: Wallets
    description: Manage customer and account wallets
  - name: Bank Accounts
    description: Manage bank accounts for payouts
  - name: Cards
    description: Manage tokenized payment cards
  - name: Subscriptions
    description: Manage recurring payment subscriptions
  - name: Verifications
    description: KYC verification for customers and accounts
  - name: Bundles
    description: Manage product bundles for orders
  - name: Refunds
    description: View refund records
paths:
  /customers/{uuid}/cards:
    post:
      tags:
        - Customers
      summary: Add card to customer
      description: >
        Adds a card to a customer. The behaviour depends on `payin_type`:


        - `DCP`, `DCP_AUTH`: tokenizes a card. The response includes a
        `tokenization_link` the customer must visit to enter the card details.

        - `STRIPE`: issues a virtual card against `wallet_id`. See [Stripe
        Authorization](/guides/stripe-authorization).

        - `M2P_ISSUING` (only when card issuing is enabled): issues a card
        linked to a wallet previously created with `POST /wallets` and `type:
        M2P_ISSUING`. Issuance is asynchronous: the card is returned with
        `confirmed: false` and becomes `confirmed: true`, with the issuer token
        in `gateway_reference_id`, once the issuer confirms it.
      operationId: createCustomerCard
      parameters:
        - $ref: '#/components/parameters/CustomerUuid'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - payin_type
              example:
                payin_type: M2P_ISSUING
                wallet_id: 51
              properties:
                payin_type:
                  type: string
                  enum:
                    - DCP
                    - DCP_AUTH
                    - STRIPE
                    - M2P_ISSUING
                wallet_id:
                  type: integer
                  description: >-
                    ID of the wallet that backs the card. Required for `STRIPE`
                    and `M2P_ISSUING`. Must belong to the customer.
                  example: 51
                ficha_beneficiario:
                  type: object
                  description: >-
                    `M2P_ISSUING` only. Optional cardholder data; cards are
                    issued anonymous by default.
                  properties:
                    nombre:
                      type: string
                    primer_apellido:
                      type: string
                    segundo_apellido:
                      type: string
                    nif:
                      type: string
                    email:
                      type: string
                      format: email
                    telefono:
                      type: string
                    fecha_nacimiento:
                      type: string
                      format: date
                    calle:
                      type: string
                    numero:
                      type: string
                    codigo_postal:
                      type: string
                    localidad:
                      type: string
                product_id:
                  type: string
                  description: '`M2P_ISSUING` only. Card product identifier.'
                card_type:
                  type: string
                  description: '`M2P_ISSUING` only. Card type or program code.'
      responses:
        '200':
          description: Card created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Card'
        '404':
          description: >-
            Customer or wallet not found, or the wallet is not an `M2P_ISSUING`
            wallet of this customer.
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  parameters:
    CustomerUuid:
      name: uuid
      in: path
      required: true
      schema:
        type: string
      description: Customer UUID.
  schemas:
    Card:
      type: object
      properties:
        id:
          type: integer
        self:
          type: string
        uuid:
          type: string
        type:
          type: string
          nullable: true
          description: Card brand (e.g. `VISA`, `MASTERCARD`).
        cardholder:
          type: string
          nullable: true
        alias:
          type: string
          nullable: true
          description: Masked card number alias (e.g. `4242XXXXXXXX4242`).
        expiration:
          type: string
          nullable: true
          example: 12/26
        issuing_country:
          type: string
          nullable: true
        issuing_bank:
          type: string
          nullable: true
        is_3d_secure:
          type: boolean
          nullable: true
        confirmed:
          type: boolean
          description: Whether the card has been successfully tokenized and confirmed.
        payin_type:
          type: string
          nullable: true
          description: Payment type this card is associated with.
        tokenization_link:
          type: string
          format: uri
          nullable: true
          description: >-
            URL to complete card tokenization. Only present immediately after
            creation.
        gateway_reference_id:
          type: string
          nullable: true
          description: >-
            Identifier of the card at the issuer (`STRIPE`, `M2P_ISSUING`). Only
            present for cards linked to a wallet.
        created_at:
          type: string
          format: date-time
          nullable: true
        connections:
          $ref: '#/components/schemas/Connections'
    Connections:
      type: object
      description: Hypermedia links to related resources.
      additionalProperties:
        type: string
  responses:
    ValidationError:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                example: The given data was invalid.
              errors:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: string
                example:
                  name:
                    - The name field is required.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Use your account's **Secret Key** as the Bearer token.

````

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