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 response, with the new owner in the customer_id field.

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 endpoint.

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

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.

PATCH/payment-methods/{payment_method_id}

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.

Header Parameters

X-account-codestringrequired

The unique identifier of your account (UUID).

Path Parameters

payment_method_idstringrequired

The unique identifier of the payment_method. This is the vaulted_token received when enrolling a payment method with Enroll Payment Method (UUID).

Body application/json

customer_idstringrequired

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.

Response

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

idempotency_keystring
namestring
descriptionstring
typestring
categorystring
countrystring
parent_typeany
statusstring
sub_statusstring
vaulted_tokenstring
callback_urlany
actionany
redirect_urlany
created_atstring
updated_atstring
card_dataobject
Show card_data properties
iinstring
lfdstring
holder_namestring

Cardholder’s full name as returned by the payment provider.

expiration_monthinteger
expiration_yearinteger
number_lengthinteger
security_code_lengthinteger
brandstring
issuerstring
issuer_codeany
country_codestring

ISO 3166-1 alpha-2 country code of the card’s issuing country.

categorystring
typestring
fingerprintstring
last_successfully_usedany
last_successfully_used_atany
preferredany
customer_idstring

The unique identifier of the customer the payment method now belongs to. Returned by the reassignment response so you can confirm the new owner.

verifyany

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.

messagesstring[]

Human-readable description of the error.

The payment method does not exist for this account.

code"PAYMENT_METHOD_NOT_FOUND"

Machine-readable error code.

messagesstring[]

Human-readable description of the error.

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

code"CONFLICT"

Machine-readable error code.

messagesstring[]

Human-readable description of the error.

Request
curl -X PATCH "https://api-sandbox.whitelabel.com/v1/payment-methods/<payment_method_id>" \
  -H "Content-Type: application/json" \
  -H "X-account-code: <X-account-code>" \
  -H "public-api-key: <public-api-key>" \
  -H "private-secret-key: <private-secret-key>" \
  -d '{
  "customer_id": "string"
}'
Response
{
  "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
}