Store Hugs Developers

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:

FieldTypeDescription
idinteger
namestring
emailstring or null
emailVerifiedboolean
phonestring or null
wholesaleobject or null
wholesale.namestring
accountUrlstring (uri)The shopper's account page on the shop's host.

Errors

StatusWhen
401invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop.
402The shop is suspended (message only).
403origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only).
404Not found, or the shop's plan has no Integration API.
429Rate 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

StatusWhen
401invalid_api_key, or invalid_customer_token: the shopper's token is missing or not valid for this shop.
402The shop is suspended (message only).
403origin_not_allowed (publishable key from an unlisted site), secret_key_in_browser, or the shop is not live (message only).
404Not found, or the shop's plan has no Integration API.
409idempotency_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.
422Validation errors ({ message, errors }), or an idempotency refusal(idempotency_key_reused, idempotency_key_invalid).
429Rate limited.

Example

$shopper->customer->logout();