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

# Attach payment method

> Attach a Stripe PaymentMethod to a workspace's billing customer via the Nedzo REST API. The first attached method automatically becomes the default.

<ParamField path="workspaceId" type="string" required>
  Workspace UUID
</ParamField>

<ParamField body="paymentMethodId" type="string" required>
  Stripe PaymentMethod ID (starts with `pm_`), already confirmed against the setup intent on the frontend.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.nedzo.ai/v1/workspaces/19c3b12f-ec54-43ad-8686-00e921f1befd/billing/payment-methods/attach" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "paymentMethodId": "pm_1234567890abcdef"
      }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "paymentMethod": {
      "id": "pm_1234567890abcdef",
      "type": "card",
      "brand": "visa",
      "last4": "4242",
      "expMonth": 12,
      "expYear": 2030,
      "isDefault": true,
      "createdAt": "2026-04-17T10:30:00Z"
    },
    "isDefault": true
  }
  ```
</ResponseExample>
