# Customers

### Create a Customer

```graphql
mutation {
  createCustomer(
    email: "test@example.com"
    firstName: "John"
    lastName: "Doe"
    country: "VHlwZXM6OkNvdW50cnktNjNjNTQyZDUtOTRhZC00NWIyLWE0YzQtOWI5ZGExOTU5ZjA1"
  ) {
    id
    email
    firstName
    lastName
  }
}
```

<table><thead><tr><th width="114.77777099609375">Argument</th><th width="104.33331298828125">Type</th><th width="106.5078125" data-type="checkbox">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>email</code></td><td><code>String!</code></td><td>true</td><td>Customer’s email (must be unique per account).</td></tr><tr><td><code>firstName</code></td><td><code>String!</code></td><td>true</td><td>First name.</td></tr><tr><td><code>lastName</code></td><td><code>String!</code></td><td>true</td><td>Last name.</td></tr><tr><td><code>country</code></td><td><code>ID!</code></td><td>true</td><td>Global ID of a country from <a href="https://docs.cashramp.co/cashramp/cashramp-api/queries#available-countries"><code>availableCountries</code></a>.</td></tr></tbody></table>

The mutation returns the new customer’s global `id`, which you’ll reference in future calls (e.g., adding a payment method).

***

### List Customers

```graphql
query {
  account {
    merchantCustomers {
      nodes {
        id
        email
        firstName
        lastName
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}
```

`merchantCustomers` is a **Relay-style connection**. To fetch the next page, pass `after: <endCursor>`:

```graphql
query {
  account {
    merchantCustomers(after: "Mg") {
      nodes {
        id
        email
        firstName
        lastName
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}
```

***

### Fetch a single customer

```graphql
query {
  merchantCustomer(email: "") {
    id
    email
    firstName
    lastName
  }
}
```

<table><thead><tr><th>Argument</th><th>Type</th><th data-type="checkbox">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code></td><td>ID</td><td>false</td><td>The global ID of the customer</td></tr><tr><td><code>email</code></td><td>String</td><td>false</td><td>The email address of the customer</td></tr></tbody></table>
