# Reassign a Payment Method to Another Customer

Reassign an enrolled payment method to a different customer of the same account. Send the `customer_id` of the target customer in the request body. Only card payment methods can be reassigned. The response returns the payment method in the same shape as the [Enroll Payment Method](/reference/enroll-payment-method-api) response, with the new owner in the `customer_id` field.

<Note>
To reassign the payment method, you need to provide the `payment_method_id`, which is the `vaulted_token` received when using the [Enroll Payment Method](/reference/enroll-payment-method-api) endpoint.
</Note>

A payment method that is already assigned to a customer that has data cannot be reassigned, and the request is rejected with `409 CONFLICT`.

<Warning>
After a payment method is reassigned, the merchant is responsible for updating the customer identifier wherever the payment method was already used. This includes any subscription created with it, the merchant's own mapping between a user and the `vaulted_token`, and any stored pair of customer and payment method. WHITELABEL reassigns the payment method to the new customer, but it does not update those references on the merchant side.
</Warning>

**PATCH** `/payment-methods/{payment_method_id}`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Reassigns an enrolled payment method to a different customer of the same account. Only card payment methods can be reassigned. The reassignment fails when the payment method is already assigned to a customer that has data. Returns the payment method in the same shape as the Enroll Payment Method response, with the new owner in the `customer_id` field.

## Authorization

- public-api-key (apiKey in header)
- private-secret-key (apiKey in header)

## Header parameters

- `X-account-code` (string, required)
  The unique identifier of your account (UUID).

## Path parameters

- `payment_method_id` (string, required)
  The unique identifier of the `payment_method`. This is the `vaulted_token` received when enrolling a payment method with [Enroll Payment Method](/reference/enroll-payment-method-api) (UUID).

## Body

Content type: `application/json`

- `customer_id` (string, required)
  The unique identifier of the customer the payment method is reassigned to (UUID). The payment method can be reassigned only while its current customer has no data; otherwise the request returns `409 CONFLICT`.

Example:

```json
{
  "customer_id": "string"
}
```

## Responses

### 200

The reassigned payment method, including the new owner in the `customer_id` field.

- `idempotency_key` (string)
- `name` (string)
- `description` (string)
- `type` (string)
- `category` (string)
- `country` (string)
- `parent_type` (any)
- `status` (string)
- `sub_status` (string)
- `vaulted_token` (string)
- `callback_url` (any)
- `action` (any)
- `redirect_url` (any)
- `created_at` (string)
- `updated_at` (string)
- `card_data` (object)
  - `iin` (string)
  - `lfd` (string)
  - `holder_name` (string)
    Cardholder's full name as returned by the payment provider.
  - `expiration_month` (integer)
  - `expiration_year` (integer)
  - `number_length` (integer)
  - `security_code_length` (integer)
  - `brand` (string)
  - `issuer` (string)
  - `issuer_code` (any)
  - `country_code` (string)
    ISO 3166-1 alpha-2 country code of the card's issuing country.
  - `category` (string)
  - `type` (string)
  - `fingerprint` (string)
- `last_successfully_used` (any)
- `last_successfully_used_at` (any)
- `preferred` (any)
- `customer_id` (string)
  The unique identifier of the customer the payment method now belongs to. Returned by the reassignment response so you can confirm the new owner.
- `verify` (any)

Example:

```json
{
  "idempotency_key": "a0000000-0000-4000-8000-000000000010",
  "name": "VISA ****1111",
  "description": "VISA ****1111",
  "type": "CARD",
  "category": "CARD",
  "country": "US",
  "parent_type": null,
  "status": "ENROLLED",
  "sub_status": "ENROLLED",
  "vaulted_token": "b0000000-0000-4000-8000-000000000002",
  "callback_url": null,
  "action": null,
  "redirect_url": null,
  "created_at": "2024-06-04T12:47:46.992602Z",
  "updated_at": "2024-06-04T12:47:46.992603Z",
  "card_data": {
    "iin": "41111111",
    "lfd": "1111",
    "holder_name": "JOHN DOE",
    "expiration_month": 3,
    "expiration_year": 26,
    "number_length": 16,
    "security_code_length": 3,
    "brand": "VISA",
    "issuer": "JPMORGAN CHASE BANK N A",
    "issuer_code": null,
    "country_code": "US",
    "category": "CREDIT",
    "type": "CREDIT",
    "fingerprint": "55a7fe38-cdc3-45dc-8c5f-820751799c76"
  },
  "last_successfully_used": null,
  "last_successfully_used_at": null,
  "preferred": null,
  "customer_id": "b3f2c1a0-1234-4a5b-9c8d-000000000001",
  "verify": null
}
```

### 400

The request is invalid, the target customer does not exist, or the payment method is not a card.

- `code` ("INVALID_PARAMETERS" | "BAD_REQUEST" | "CUSTOMER_NOT_FOUND" | "PAYMENT_METHOD_NOT_REASSIGNABLE")
  Machine-readable error code.
- `messages` (string[])
  Human-readable description of the error.

Example:

```json
{
  "code": "INVALID_PARAMETERS",
  "messages": [
    "string"
  ]
}
```

### 404

The payment method does not exist for this account.

- `code` ("PAYMENT_METHOD_NOT_FOUND")
  Machine-readable error code.
- `messages` (string[])
  Human-readable description of the error.

Example:

```json
{
  "code": "PAYMENT_METHOD_NOT_FOUND",
  "messages": [
    "string"
  ]
}
```

### 409

The payment method is already assigned to a customer that has data.

- `code` ("CONFLICT")
  Machine-readable error code.
- `messages` (string[])
  Human-readable description of the error.

Example:

```json
{
  "code": "CONFLICT",
  "messages": [
    "string"
  ]
}
```