# Customer

## Authenticate customer

> Creates a customer and returns a customer token from a platform account.

```json
{"openapi":"3.1.1","info":{"title":"PayNow Storefront (Headless) API","version":"v1"},"tags":[{"name":"customer"}],"paths":{"/v1/store/customer/auth":{"post":{"tags":["customer"],"summary":"Authenticate customer","description":"Creates a customer and returns a customer token from a platform account.","operationId":"StorefrontAuth_AuthenticateStorefrontCustomer","parameters":[{"name":"x-paynow-store-id","in":"header","description":"PayNow Store Identifier (Store ID) available in Store Settings","required":true,"schema":{"type":"string","format":"flake-id"}},{"name":"x-paynow-customer-ip","in":"header","description":"The IP address (IPv4 or IPv6) of the customer. Required if the request is not being made from the customer's browser.","schema":{"type":"string","format":"ipv4"}},{"name":"x-paynow-customer-countrycode","in":"header","description":"The customer's country code in ISO 3166-1 alpha-2 format. Optional, but recommended if you have this available.","schema":{"pattern":"^[A-Z]{2}$","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthenticateStorefrontCustomerRequestDto"}},"text/json":{"schema":{"$ref":"#/components/schemas/AuthenticateStorefrontCustomerRequestDto"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/AuthenticateStorefrontCustomerRequestDto"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthenticateStorefrontCustomerResponseDto"}}}},"default":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayNowError"}}}}}}}},"components":{"schemas":{"AuthenticateStorefrontCustomerRequestDto":{"required":["id","platform"],"type":"object","properties":{"platform":{"$ref":"#/components/schemas/CustomerProfilePlatform"},"id":{"type":"string","description":"The account ID on the platform"}},"additionalProperties":false},"CustomerProfilePlatform":{"enum":["invalid","steam","minecraft","paynow_name","paynow","minecraft_java_name","minecraft_bedrock_name","xbox_xuid","minecraft_uuid"],"type":"string"},"AuthenticateStorefrontCustomerResponseDto":{"required":["customer_token"],"type":"object","properties":{"customer_token":{"type":"string","description":"The token for the Customer"}},"additionalProperties":false},"PayNowError":{"required":["code","message","status"],"type":"object","properties":{"status":{"type":"integer","description":"The HTTP status code.","format":"int32"},"code":{"type":"string","description":"The PayNow parseable error code."},"message":{"type":"string","description":"The human-readable error message."},"trace_id":{"type":["null","string"],"description":"A distributed trace ID used for debugging."},"errors":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ValidationError"},"description":"An array of multiple errors. Only used by some API services."}},"additionalProperties":false,"description":"Represents a PayNow error"},"ValidationError":{"required":["code","message","path","validation"],"type":"object","properties":{"code":{"type":"string","description":"The parseable error code."},"message":{"type":"string","description":"The human-readable error message."},"path":{"type":"string","description":"The path leading to the validation error."},"validation":{"type":"string","description":"Type of the validation that failed."}},"additionalProperties":false,"description":"A validation error."}}}}
```

## Get current customer

> Retrieves the current customer from the passed Customer token.

```json
{"openapi":"3.1.1","info":{"title":"PayNow Storefront (Headless) API","version":"v1"},"tags":[{"name":"customer"}],"security":[{"Customer":[]}],"components":{"securitySchemes":{"Customer":{"type":"apiKey","description":"A Customer token generated using an API Key in the format 'Customer TOKEN_HERE'.","name":"Authorization","in":"header"}},"schemas":{"CustomerDto":{"required":["created_at","id","metadata","store_id"],"type":"object","properties":{"id":{"$ref":"#/components/schemas/FlakeId"},"store_id":{"$ref":"#/components/schemas/FlakeId"},"profile":{"$ref":"#/components/schemas/GenericProfileDto"},"steam_id":{"$ref":"#/components/schemas/SteamId"},"steam":{"$ref":"#/components/schemas/SteamProfileDto"},"minecraft_uuid":{"type":["null","string"],"description":"The customer's Minecraft UUID, if they have linked their Minecraft account.\nNot set for offline Minecraft stores. If the platform type is Minecraft - Geyser,\nand the profile is a bedrock account, this will be a UUID generated from the Xbox XUID."},"minecraft":{"$ref":"#/components/schemas/MinecraftProfileDto"},"xbox_xuid":{"type":["null","string"],"description":"The customer's Xbox XUID, if available."},"minecraft_platform":{"$ref":"#/components/schemas/CustomerMinecraftPlatform"},"name":{"type":["null","string"],"description":"The display name for the customer."},"created_at":{"type":"string","description":"The date and time when the customer was created in the system.","format":"date-time"},"updated_at":{"type":["null","string"],"description":"The date and time when the customer was last updated, if applicable.","format":"date-time"},"metadata":{"type":"object","additionalProperties":{"type":"string"},"description":"Additional custom data associated with the customer."}},"additionalProperties":false,"description":"Represents a customer in the PayNow system with their associated profiles and metadata."},"FlakeId":{"type":"string","additionalProperties":false,"format":"flake-id"},"GenericProfileDto":{"required":["id","name","platform"],"type":"object","properties":{"id":{"type":"string","description":"The platform-specific identifier for the profile."},"platform":{"type":"string","description":"The name of the platform this profile belongs to."},"name":{"type":"string","description":"The display name of the user on this platform."},"avatar_url":{"type":["null","string"],"description":"The URL to the user's avatar image on this platform."}},"additionalProperties":false,"description":"Represents a generic platform profile for a customer."},"SteamId":{"type":"string","additionalProperties":false,"description":"A 64-bit Steam account identifier. Accepts string or numeric format.","format":"steam-id"},"SteamProfileDto":{"required":["avatar_url","id","name"],"type":"object","properties":{"id":{"$ref":"#/components/schemas/SteamId"},"name":{"type":"string","description":"The display name of the user on Steam."},"avatar_url":{"type":"string","description":"The URL to the user's Steam avatar image."}},"additionalProperties":false,"description":"Represents a Steam profile for a customer."},"MinecraftProfileDto":{"required":["avatar_url","id","name"],"type":"object","properties":{"id":{"type":"string","description":"The UUID of the Minecraft player.\nIf the platform is Minecraft Offline, this will be the name itself.\nIf the platform is Minecraft Geyser, and this is a Bedrock account, this ID will be an Xbox XUID."},"name":{"type":"string","description":"The username of the Minecraft player."},"avatar_url":{"type":"string","description":"The URL to the player's Minecraft skin rendered as an avatar."}},"additionalProperties":false,"description":"Represents a Minecraft profile for a customer."},"CustomerMinecraftPlatform":{"enum":["unknown","java","bedrock"],"type":"string"},"PayNowError":{"required":["code","message","status"],"type":"object","properties":{"status":{"type":"integer","description":"The HTTP status code.","format":"int32"},"code":{"type":"string","description":"The PayNow parseable error code."},"message":{"type":"string","description":"The human-readable error message."},"trace_id":{"type":["null","string"],"description":"A distributed trace ID used for debugging."},"errors":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ValidationError"},"description":"An array of multiple errors. Only used by some API services."}},"additionalProperties":false,"description":"Represents a PayNow error"},"ValidationError":{"required":["code","message","path","validation"],"type":"object","properties":{"code":{"type":"string","description":"The parseable error code."},"message":{"type":"string","description":"The human-readable error message."},"path":{"type":"string","description":"The path leading to the validation error."},"validation":{"type":"string","description":"Type of the validation that failed."}},"additionalProperties":false,"description":"A validation error."}}},"paths":{"/v1/store/customer":{"get":{"tags":["customer"],"summary":"Get current customer","description":"Retrieves the current customer from the passed Customer token.","operationId":"StorefrontCustomer_GetStorefrontCustomer","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerDto"}}}},"default":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayNowError"}}}}}}}}}
```

## GET /v1/store/customer/giftcards/lookup/{code}

> Lookup a gift card by the code

```json
{"openapi":"3.1.1","info":{"title":"PayNow Storefront (Headless) API","version":"v1"},"tags":[{"name":"customer"}],"security":[{"Customer":[]}],"components":{"securitySchemes":{"Customer":{"type":"apiKey","description":"A Customer token generated using an API Key in the format 'Customer TOKEN_HERE'.","name":"Authorization","in":"header"}},"schemas":{"StorefrontGiftCardDto":{"required":["balance","code","starting_balance"],"type":"object","properties":{"code":{"type":"string"},"balance":{"type":"integer","format":"int32"},"starting_balance":{"type":"integer","format":"int32"},"expires_at":{"type":["null","string"],"format":"date-time"}},"additionalProperties":false},"PayNowError":{"required":["code","message","status"],"type":"object","properties":{"status":{"type":"integer","description":"The HTTP status code.","format":"int32"},"code":{"type":"string","description":"The PayNow parseable error code."},"message":{"type":"string","description":"The human-readable error message."},"trace_id":{"type":["null","string"],"description":"A distributed trace ID used for debugging."},"errors":{"type":["null","array"],"items":{"$ref":"#/components/schemas/ValidationError"},"description":"An array of multiple errors. Only used by some API services."}},"additionalProperties":false,"description":"Represents a PayNow error"},"ValidationError":{"required":["code","message","path","validation"],"type":"object","properties":{"code":{"type":"string","description":"The parseable error code."},"message":{"type":"string","description":"The human-readable error message."},"path":{"type":"string","description":"The path leading to the validation error."},"validation":{"type":"string","description":"Type of the validation that failed."}},"additionalProperties":false,"description":"A validation error."}}},"paths":{"/v1/store/customer/giftcards/lookup/{code}":{"get":{"tags":["customer"],"summary":"Lookup a gift card by the code","operationId":"StorefrontCustomer_GetStorefrontGiftCard","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorefrontGiftCardDto"}}}},"default":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayNowError"}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.paynow.gg/storefront-headless/storefront-api/customer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
