---
search:
  tags:
    - billing
    - POST
seo:
  description: >-
    Attach a customer payment method from a setup session. Reference for the
    POST /v1/customers/{customerId}/payment-methods endpoint in the Vortex
    Payments API.
sidebar:
  label: Attach a customer payment method from a setup session
  badge: POST
title: Attach a customer payment method from a setup session
type: openapi-operation
---
`POST /v1/customers/{customerId}/payment-methods`

**curl**

```bash
curl "https://api.vortex.nyc/v1/customers/{customerId}/payment-methods?environment=sandbox&merchantAccountId=..." \
  -X POST \
  -H "Authorization: Bearer $VORTEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"paymentMethodSetupSessionId":"pmset_123","setupToken":"tok_123","setAsDefault":true}'
```

**TypeScript**

```ts
import { attachCustomerPaymentMethod, createVortex } from "@vortex-api/vortex/2026-09";

const vortex = createVortex({ apiKey: process.env.VORTEX_API_KEY });
const { data } = await attachCustomerPaymentMethod({
  client: vortex,
  path: { customerId: "..." },
  query: { environment: "sandbox", merchantAccountId: "..." },
  body: {"paymentMethodSetupSessionId":"pmset_123","setupToken":"tok_123","setAsDefault":true},
});
```

**Request body** (`application/json`, required)

- `billingAccountId` (string)
- `paymentMethodSetupSessionId` (string, required)
- `setupToken` (string, required)
- `setAsDefault` (boolean)
- `idempotencyKey` (string)

Request body example:

```json
{
  "paymentMethodSetupSessionId": "pmset_123",
  "setupToken": "tok_123",
  "setAsDefault": true
}
```

**Responses**

- `201` — Created
- `400` — Bad request, including malformed JSON
- `401` — Missing or invalid API key
- `409` — Conflict, including idempotency body drift
- `422` — Validation failed
- `429` — API key rate limit exceeded
- `default` — Error

Response example, 201:

```json
{
  "data": {},
  "requestId": "string"
}
```
