Customer
Customers represent buyers identified by their blockchain wallet address.
Methods
| Method | Description | Returns |
|---|---|---|
| create | Create a new customer | Customer |
| list | List all customers | Customer[] |
| get | Get a customer by ID | Customer |
| update | Update a customer | Customer |
| check | Check if customer has paid for a product | { allowed: boolean } |
create
Type (parameters: { walletAddress: string; email?: string; name?: string; externalID?: string }) => Promise<Customer>
Create a new customer with wallet address and optional metadata.
const customer = await stackup.customer.create({
walletAddress: "0x1234567890abcdef1234567890abcdef12345678",
email: "user@example.com",
name: "John Doe",
externalID: "user_123"
})Wallet addresses are automatically checksummed for consistency.
list
Type () => Promise<Customer[]>
List all customers for the current workspace.
const customers = await stackup.customer.list()get
Type (parameters: { id: string }) => Promise<Customer>
Get a customer by their ID.
const customer = await stackup.customer.get({ id: "cus_01ABC123" })update
Type (parameters: { id: string; email?: string; name?: string; externalID?: string }) => Promise<Customer>
Update an existing customer's properties.
await stackup.customer.update({
id: "cus_01ABC123",
email: "newemail@example.com"
})check
Type (parameters: { customerID: string; productID: string }) => Promise<{ allowed: boolean }>
Verify if a customer has paid for a specific product.
const { data } = await stackup.customer.check({
customerID: "cus_01ABC123",
productID: "prd_01DEF456"
})
if (data.allowed) {
// Grant access
}Auto-Creation
Customers are automatically created during checkout if not pre-assigned. The buyer's wallet address is used to create or match an existing customer.
Types
Customer
| Property | Type | Description |
|---|---|---|
| id | string | Unique identifier |
| workspaceID | string | Parent workspace |
| walletAddress | string | Customer wallet address (0x...) |
| string | null | Optional email address | |
| name | string | null | Optional display name |
| externalID | string | null | Optional external identifier |
| timeCreated | Date | Creation timestamp |
| timeUpdated | Date | Last modification |
| timeDeleted | Date | null | Soft delete timestamp |
Errors
A list of errors that can be returned by the Customer API.
CustomerCreateErrors
The customer creation request was invalid.
Status: 400 BadRequestError
CustomerGetErrors
The customer could not be retrieved.
Status: 400 BadRequestError, 404 NotFoundError
CustomerUpdateErrors
The customer update request was invalid or customer not found.
Status: 400 BadRequestError, 404 NotFoundError
CustomerCheckErrors
The check request was invalid or customer/product not found.
Status: 400 BadRequestError, 404 NotFoundError