Function Signature
Description
Creates and configures a client for interacting with the PayNow Storefront API. The Storefront API is used for customer-facing operations like browsing products, managing carts, and processing checkouts.Parameters
Your PayNow store identifier. This is used to scope all API requests to your specific store.
Optional customer authentication token. Include this when making authenticated requests on behalf of a specific customer. The token is automatically formatted with the
Customer prefix in the Authorization header.When to use:- Accessing customer-specific cart data
- Retrieving customer order history
- Managing customer profiles
- Browsing public product catalogs
- Viewing store information
- Anonymous cart operations
Additional Axios configuration options to customize the HTTP client behavior.Common options:
timeout: Request timeout in millisecondsheaders: Additional HTTP headers to include in all requestsbaseURL: Override the default API base URL (defaults tohttps://api.paynow.gg)validateStatus: Custom function to determine if a status code should resolve or reject
Returns
A typed client instance with grouped API operations. Operations are organized by resource type (e.g., Each operation returns an Axios response with the typed data in the
cart, checkout, products, store) and accessed using dot notation.Example structure:data property.Usage Examples
Basic Client (Unauthenticated)
Authenticated Client
With Custom Options
Error Handling
Authentication Notes
- The
customerTokenparameter is optional for public operations - When provided, the token is automatically formatted as
Customer <token>in the Authorization header - Customer tokens are typically obtained through your authentication flow
- Unauthenticated requests can still access public resources like products and store information
- Some operations require authentication and will return a 401 error if the token is missing or invalid
Related
Storefront API Overview
Explore all available Storefront API operations
Authentication Guide
Learn about authentication patterns
Error Handling
Handle errors effectively in your application
Management Client
Create a client for management operations