---
title: "Create a payment method"
method: POST
path: "/billing/customers/{customerId}/paymentmethods"
---

# Create a payment method

`POST /billing/customers/{customerId}/paymentmethods`

## Request

- Base URL: `https://api-sandbox.ezypay.com/v2`
- URL: `https://api-sandbox.ezypay.com/v2/billing/customers/{customerId}/paymentmethods`
- Auth: OAuth 2
  - Client credentials
  - Token URL: `https://identity-sandbox.ezypay.com/token`

Links a new payment method token to an existing customer. If the customer has no primary payment method specified, then the new token will become the primary payment method by default. No verification is performed during the linking of payment method.

## Path parameters

- `customerId` string, required

## Headers

- `merchant` string, required

## Request body

- object
  - `paymentMethodToken` string, required: Auto-generated unique identifier of the payment method token generated by the Ezypay Vault.
  - `primary` boolean: Specifies this token as the customer's preferred token for making payments. Supported values are `true` and `false`. If the customer has no primary payment method specified, then the new token will become the primary payment method by default. However, if the owner already has a primary payment method, then it will not change unless `primary` is set to `true`. `PromptPay` payment method token cannot be set as the `primary` payment method.

## Response `200`

200

- object
  - `paymentMethodToken` string
  - `customerId` string
  - `type` string
  - `bank` unknown
  - `card` object
    - `first6` string
    - `last4` string
    - `accountHolderName` string
    - `type` string
    - `expiryMonth` string
    - `expiryYear` string
  - `invalidReason` unknown
  - `lastUsedOn` unknown
  - `valid` boolean
  - `primary` boolean

## Other responses

- `400`: 400

## Changes

- **2026-11-03** `924be4030f56`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/ezypay/apis/vault/changes/billing/customers/:customerId/paymentmethods/post.md)

---

[API](https://skmtc.dev/ezypay/apis/vault.md) - [All operations](https://skmtc.dev/ezypay/apis/vault/llms.txt) - [OpenAPI document](https://skmtc.dev/ezypay/apis/vault/revisions/924be4030f56?raw)
