Customer
The signed-in shopper's profile, wholesale membership and sign-out.
Reach them through $shopper->customer. They need a client with the shopper's access token (see sign-in); any other token is refused with 401.
Get the shopper
$shopper->customer->get(): array
The signed-in shopper's profile, wholesale membership and a link to the hosted account page.
Returns
A StorefrontCustomer array:
| Field | Type | Description |
|---|---|---|
id | integer | |
name | string | |
email | string or null | |
emailVerified | boolean | |
phone | string or null | |
wholesale | object or null | |
wholesale.name | string | |
accountUrl | string (uri) | The shopper's account page on the shop's host. |
Errors
| Status | When |
|---|---|
401 | invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop. |
402 | The shop is suspended (message only). |
403 | origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only). |
404 | Not found, or the shop's plan has no Integration API. |
429 | Rate limited. |
Example
$me = $shopper->customer->get();
Sign the shopper out
$shopper->customer->logout(): void
Revokes the access token and its refresh token.
Returns
Nothing.
Errors
| Status | When |
|---|---|
401 | invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop. |
402 | The shop is suspended (message only). |
403 | origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only). |
404 | Not found, or the shop's plan has no Integration API. |
409 | idempotency_in_progress: a request with this Idempotency-Key is still running. Retry with the same key after Retry-After seconds; the first answer is then replayed. |
422 | Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid). |
429 | Rate limited. |
Example
$shopper->customer->logout();