# Update a customer Building with an AI agent? Start at https://docs.payme.io/agents.md - Sandbox: `PATCH https://payme-store-staging.payme.io/api/customers/{guid}` - Production: `PATCH https://payme-store.payme.io/api/customers/{guid}` ## Credentials - Header `Authorization: Bearer ` Changes some fields of one of the seller's customers. Fields you don't send, or send empty, keep their values. A `payment_tokens` array you send replaces all of the customer's saved tokens. The request names the phone fields `phone` and `additional_phone` and sends the address fields at the top level; responses name them `phone_number` and `additional_phone_number` and nest the address in `address`. Fields the API doesn't know are ignored. To replace the whole customer in one call, `PUT /customers/{guid}` takes the same body as [`POST /customers`](/products-and-customers/customers/post-customers), with the same required fields. Send `Authorization: Bearer `, the token from [`POST /auth-tokens`](/products-and-customers/authentication/post-auth-token). Hosts, tokens and the error format: [Hosts, authentication and errors](/products-and-customers/authentication). ## Parameters | Name | In | Type | Required | Description | | --- | --- | --- | --- | --- | | `guid` | path | string | yes | The customer `guid` (a UUID) that `POST /customers` returned. Any other format returns `400`. | ## Request body Content type: `application/json` The fields to change. | Field | Type | Required | Description | | --- | --- | --- | --- | | `customer_external_id` | string | no | Your own customer id, unique among the seller's customers (`409` otherwise). It isn't returned when you read the customer. Send it only to change it: resending the customer's current value also returns `409`. | | `first_name` | string | no | First name, at least 2 characters. | | `middle_name` | string | no | Middle name, at least 2 characters. | | `last_name` | string | no | Last name, at least 2 characters. | | `email` | string | no | A valid email address. | | `phone` | string | no | Main phone number, 3–20 characters. Returned as `phone_number`. | | `additional_phone` | string | no | Second phone number, 3–20 characters. Returned as `additional_phone_number`. | | `company_name` | string | no | Company name, at least 2 characters. | | `country` | string | no | Country, at least 2 characters. Returned inside `address`. | | `city` | string | no | City, at least 2 characters. Returned inside `address`. | | `street` | string | no | Street, at least 2 characters. Returned inside `address`. | | `building_number` | string | no | Building number, e.g. `12` or `12A`. Returned inside `address`. | | `floor` | string | no | Floor, at least 1 character. Returned inside `address`. | | `zip` | string | no | Postal code. Returned inside `address`. | | `description` | string | no | Your note about the customer. | | `status` | integer | no | `1` – active, `2` – draft. This call can't set `0` (inactive). | | `payment_tokens` | array | no | Payment tokens to save for the customer. The array replaces all of the customer's saved tokens. | | `payment_tokens[].token` | string | yes | The payment token to save. PayMe stores it as given. | | `payment_tokens[].token_data` | string | no | A JSON object encoded as a string, e.g. the card mask and brand: `{"card_mask":"4580 **** **** 0000","card_brand":"visa"}`. Must be valid JSON. | ### Request example ```json { "email": "dana.levi@example.com", "phone": "0527654321", "city": "Haifa" } ``` ## Code samples ### curl ```bash curl -X PATCH 'https://payme-store-staging.payme.io/api/customers/' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ' \ --data-raw '{ "email": "dana.levi@example.com", "phone": "0527654321", "city": "Haifa" }' ``` ### Node.js ```javascript const response = await fetch("https://payme-store-staging.payme.io/api/customers/", { method: "PATCH", headers: { "Content-Type": "application/json", "Authorization": "Bearer ", }, body: JSON.stringify({ "email": "dana.levi@example.com", "phone": "0527654321", "city": "Haifa" }), }); console.log(await response.text()); ``` ### Python ```python import requests response = requests.patch( "https://payme-store-staging.payme.io/api/customers/", headers={ "Authorization": "Bearer ", }, json={ "email": "dana.levi@example.com", "phone": "0527654321", "city": "Haifa", }, ) print(response.text) ``` ### PHP ```php '); curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'PATCH', CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Authorization: Bearer ', ], CURLOPT_POSTFIELDS => $body, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ## Responses ### 200 — Customer updated. (success) | Field | Type | Description | | --- | --- | --- | | `guid` | string | The customer id (a UUID). | | `created_at` | string | Creation time, ISO 8601 (UTC). | | `updated_at` | string | Time of this update, ISO 8601 (UTC). | ```json { "guid": "6c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f", "created_at": "2026-11-01T09:30:00.000Z", "updated_at": "2026-11-09T10:00:00.000Z" } ``` ### 400 — A field is invalid, the body isn't valid JSON, or `guid` isn't a UUID. (error) | Field | Type | Description | | --- | --- | --- | | `status_error_details` | string | What went wrong. Validation messages are in Hebrew unless you send `Accept-Language: en`. | | `status_error_code` | integer | `501` for a validation error or a body that isn't valid JSON, `999` for any other error. | | `validation_errors` | object | The fields that failed validation. Each key is a field name; its value maps each failed rule to a message. | | `session` | string | Trace id of the request. Quote it when you contact PayMe support. | ```json { "status_error_details": "Field validation failed.", "validation_errors": { "email": { "is_email": "The value must be a valid email address." } }, "status_error_code": 501, "session": "f3a1c2b0-9e4d-11ef-8c1a-0242ac120002" } ``` ### 401 — The `Authorization` header is missing, or the access token is invalid or expired. Get a new token with `POST /refresh-exchanges` or `POST /auth-tokens`. (error) | Field | Type | Description | | --- | --- | --- | | `status_error_details` | string | What went wrong. | | `status_error_code` | integer | `999`. | | `session` | string | Trace id of the request. Quote it when you contact PayMe support. | ```json { "status_error_details": "Unauthorized", "status_error_code": 999, "session": "f3a1c2b0-9e4d-11ef-8c1a-0242ac120002" } ``` ### 404 — The customer doesn't exist, was deleted, or belongs to another seller. (error) | Field | Type | Description | | --- | --- | --- | | `status_error_details` | string | What went wrong. | | `status_error_code` | integer | `999`. | | `session` | string | Trace id of the request. Quote it when you contact PayMe support. | ```json { "status_error_details": "Customer not found", "status_error_code": 999, "session": "f3a1c2b0-9e4d-11ef-8c1a-0242ac120002" } ``` ### 409 — `customer_external_id` is already used by another of the seller's customers. (error) | Field | Type | Description | | --- | --- | --- | | `status_error_details` | string | What went wrong. | | `status_error_code` | integer | `999`. | | `session` | string | Trace id of the request. Quote it when you contact PayMe support. | ```json { "status_error_details": "Customer external id already exist", "status_error_code": 999, "session": "f3a1c2b0-9e4d-11ef-8c1a-0242ac120002" } ``` ### 500 — Server error. Contact PayMe support and quote the `session`. (error) | Field | Type | Description | | --- | --- | --- | | `status_error_details` | string | What went wrong. | | `status_error_code` | integer | `999`. | | `session` | string | Trace id of the request. Quote it when you contact PayMe support. |