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

# Attach a payment method

Attaches a payment method to a driver or fleet. Provide either `driver` or `fleet` in the request body.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.chargeapi.co/v1/payment_methods/pm_YZ2pk06eeGEvSXx7gXPApThoIJ7jv5B8/attach \
    -H "Authorization: Bearer ch_sk_test_..." \
    --json '{
    "fleet": "flt_yLqHyRXzLr5QRcbDGfqtQAaMesRH9Uvg"
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
      "id": "pm_YZ2pk06eeGEvSXx7gXPApThoIJ7jv5B8",
      "object": "payment_method",
      "bank_account": null,
      "billing_details": {
          "address": {
              "city": "Paris",
              "country": "FR",
              "line1": "10 Rue de la Paix",
              "line2": "Batiment A",
              "postal_code": "75002",
              "state": "Ile-de-France"
          },
          "email": "example@example.com",
          "name": "Example",
          "phone": "+33189000023"
      },
      "card": {
          "brand": "visa",
          "exp_month": 12,
          "exp_year": 2030,
          "fingerprint": "fp_card_example",
          "last4": "4242"
      },
      "created": "2026-04-01T00:08:24.683Z",
      "driver": null,
      "fleet": "flt_yLqHyRXzLr5QRcbDGfqtQAaMesRH9Uvg",
      "type": "card",
      "wallet": null
  }
  ```
</ResponseExample>

## Parameters

<ParamField body="driver" type="string">
  Driver to use for this request.
</ParamField>

<ParamField body="fleet" type="string">
  Fleet to use for this request.
</ParamField>

## Returns

Returns the payment method.
