# Update Customer

- Sandbox: `PATCH https://sandbox.payme.io/api/customers/{guid}`
- Production: `PATCH https://live.payme.io/api/customers/{guid}`

## Credentials

- Header `Authorization: Bearer <token>`

Update customer details.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `guid` | path | string | yes | The unique PayMe customer identifier. |

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `customer_remote_id` | string | no | The unique identifier for the customer. |
| `first_name` | string | no | The customer's first name. |
| `middle_name` | string | no | The customer's middle name. |
| `last_name` | string | no | The customer's last name. |
| `email` | string | no | The customer's email. |
| `phone_number` | string | no | The customer's mobile number. |
| `additional_phone_number` | string | no | Additional phone number of the customer. |
| `country` | string | no | The customer's country. |
| `city` | string | no | The customer's city. |
| `street` | string | no | The customer's street. |
| `building_number` | string | no | The customer's building number. |
| `floor` | string | no | The customer's floor. |
| `zip` | string | no | The customer's ZIP code. |
| `company_name` | string | no | The customer's company name. |
| `gender` | string | no | The customer's gender. |
| `description` | string | no | The customer description. |
| `birthday` | string | no | The customer's birthday. |
| `payment_tokens` | object | no |  |
| `payment_tokens.payment_method` | string | no | The payment method of the token. Allowed values: 1. `Credit Card` 2. `IL Direct Debit` |
| `payment_tokens.token_guid` | string | no | The unique identifier of the token in PayMe. |

### Request example

No example is documented; this template is generated from the fields — replace the placeholder values.

```json
{
  "customer_remote_id": "<customer_remote_id>",
  "first_name": "<first_name>",
  "middle_name": "<middle_name>",
  "last_name": "<last_name>",
  "email": "<email>",
  "phone_number": "<phone_number>",
  "additional_phone_number": "<additional_phone_number>",
  "country": "<country>",
  "city": "<city>",
  "street": "<street>",
  "building_number": "<building_number>",
  "floor": "<floor>",
  "zip": "<zip>",
  "company_name": "<company_name>",
  "gender": "<gender>",
  "description": "<description>",
  "birthday": "<birthday>",
  "payment_tokens": {}
}
```

## Code samples

### curl

```bash
curl -X PATCH 'https://sandbox.payme.io/api/customers/<guid>' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <YOUR_TOKEN>' \
  --data-raw '{}'
```

### Node.js

```javascript
const response = await fetch("https://sandbox.payme.io/api/customers/<guid>", {
  method: "PATCH",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <YOUR_TOKEN>",
  },
  body: JSON.stringify({}),
});

console.log(await response.text());
```

### Python

```python
import requests

response = requests.patch(
    "https://sandbox.payme.io/api/customers/<guid>",
    headers={
        "Authorization": "Bearer <YOUR_TOKEN>",
    },
    json={},
)

print(response.text)
```

### PHP

```php
<?php

$body = <<<'BODY'
{}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/customers/<guid>');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer <YOUR_TOKEN>',
    ],
    CURLOPT_POSTFIELDS => $body,
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
```

## Responses

### 200 — Customer updated successfully. (success)

| Field | Type | Description |
| --- | --- | --- |
| `created_at` | string | The timestamp of the update. |
| `updated_at` | string | The timestamp of the update. |
| `guid` | integer | The unique PayMe customer identifier. |

### 400 — Bad Request (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer |  |
| `message` | string |  |
| `status_error_code` | integer |  |

### 401 — Unauthorized (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer |  |
| `message` | string |  |
| `status_error_code` | integer |  |

### 500 — Internal Server Error (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer |  |
| `message` | string |  |
| `status_error_code` | integer |  |
