---
title: "Create customer payment method by external ID"
method: POST
path: "/customers/external/{externalId}/payment-methods"
tags: ["customers"]
---

# Create customer payment method by external ID

`POST /customers/external/{externalId}/payment-methods`

## Request

- Base URL: `https://api.agentpaid.io/api/v1`
- URL: `https://api.agentpaid.io/api/v1/customers/external/{externalId}/payment-methods`
- Auth: HTTP bearer

Creates a new payment method for a customer using a Stripe confirmation token.

## Path parameters

- `externalId` string, required

## Request body

- object
  - `confirmationToken` string, required: Stripe confirmation token for the payment method
  - `returnUrl` string, required: URL to redirect to after payment method setup
  - `metadata` object: Optional metadata to attach to the payment method

## Response `200`

Payment method created successfully

- PaymentMethod: A customer's payment method
  - `id` string: The payment method ID (typically from Stripe)
  - `type` 'card' | 'us_bank_account' | 'sepa_debit': The type of payment method
  - `card` PaymentMethodCard: Card details (present when type is 'card')
    - `brand` string: Card brand (visa, mastercard, amex, etc.)
    - `last4` string: Last 4 digits of the card number
    - `expMonth` integer: Expiration month (1-12)
    - `expYear` integer: Expiration year
  - `usBankAccount` PaymentMethodUsBankAccount: US bank account details (present when type is 'us_bank_account')
    - `bankName` string
    - `last4` string: Last 4 digits of the account number
    - `accountType` 'checking' | 'savings'
  - `isDefault` boolean: Whether this is the customer's default payment method
  - `createdAt` string, date-time

## Other responses

- `400`: Bad request - Missing confirmation token or invalid request
- `403`: Forbidden - Invalid or missing API key
- `404`: Customer not found

---

[API](https://skmtc.dev/paid/apis/paid-2.md) - [All operations](https://skmtc.dev/paid/apis/paid-2/llms.txt) - [OpenAPI document](https://skmtc.dev/paid/apis/paid-2/revisions/dbdf4a60ed27?raw)
