# Customer (https://dev.cosmospay.lat/docs/sdk/definitions/server/customer/)

> A customer record, optionally enriched with on-chain payment stats. Reference for the Customer class of @cosmosapp/pay_sdk: its members and their signatures.

A customer record, optionally enriched with on-chain payment stats.

## Constructor

### Customer

```ts
constructor(client: Client, data: CustomerData)
```

**Parameters**

- `client`: [`Client`](https://dev.cosmospay.lat/docs/sdk/definitions/server/client/)
- `data`: `CustomerData`

## Properties

### name

```ts
name: string
```

### alias

```ts
alias: string | null
```

### note

```ts
note: string | null
```

### email

```ts
email: string | null
```

### wallets

The customer's wallets, oldest first, on Stellar, Solana or Monad. Payments paid from any of them count toward the customer.

```ts
wallets: CustomerWalletData[]
```

### account

```ts
account: string | null
```

### reference

```ts
reference: string | null
```

### createdAt

```ts
createdAt: Date
```

### updatedAt

```ts
updatedAt: Date
```

### payments

Number of payment intents from this customer's wallets (list view only).

```ts
payments: number | null
```

### succeeded

Number of succeeded payments (list view only).

```ts
succeeded: number | null
```

### total

Total settled amount as a decimal string (list view only).

```ts
total: string | null
```

### protected

```ts
protected _patch(data: CustomerData): this
```

### deleted

```ts
deleted: boolean
```

### member

```ts
}>
```

## Methods

### fetch()

Re-fetch this customer.

```ts
fetch(): Promise<Customer>
```

**Returns** `Promise<Customer>`

### edit()

Update this customer. Mutates and returns this.

```ts
edit(options: UpdateCustomerOptions): Promise<this>
```

**Parameters**

- `options`: `UpdateCustomerOptions`

**Returns** `Promise<this>`

### delete()

Delete this customer.

```ts
delete(): Promise<{ id: string
```

**Returns** `Promise<{ id: string`

### addWallet()

Add a wallet to this customer and to &#123;@link Customer.wallets&#125;. A wallet the customer already holds answers as it is.

```ts
addWallet(options: AddCustomerWalletOptions): Promise<CustomerWalletData>
```

**Parameters**

- `options`: `AddCustomerWalletOptions`

**Returns** `Promise<CustomerWalletData>`

### removeWallet()

Remove one of this customer's wallets, by id or as read from &#123;@link Customer.wallets&#125;.

```ts
removeWallet(wallet: string | CustomerWalletData): Promise<CustomerWalletDeletedData>
```

**Parameters**

- `wallet`: `string | CustomerWalletData`

**Returns** `Promise<CustomerWalletDeletedData>`

### toJSON()

```ts
toJSON(): CustomerData
```

**Returns** `CustomerData`

## Related

- [Client](https://dev.cosmospay.lat/docs/sdk/definitions/server/client/)
- [Base](https://dev.cosmospay.lat/docs/sdk/definitions/server/base/)
