StorefrontSchemas export provides TypeScript type definitions for all request and response schemas in the Storefront API.
Overview
The Storefront API schemas are automatically generated from the PayNow OpenAPI specification and provide type safety for customer-facing operations like browsing products, managing carts, and creating checkout sessions.Using Storefront Schemas
Typing API Responses
UseStorefrontSchemas to type data returned from Storefront API methods:
Typing Request Payloads
Type your request payloads for better type safety:Common Storefront Schemas
CartDto
Represents a customer’s shopping cart.The Flake ID of the store
The Flake ID of the customer
The line items in the cart
The total price of all items in the cart in the smallest currency unit (e.g., cents)
The currency code (e.g., usd, eur, gbp)
CartLineDto
Represents a line item in a cart.The unique key for this line item
The Flake ID of the product
The name of the product
The slug of the product
The price of the product in the smallest currency unit (e.g., cents)
The quantity of this product in the cart
Indicates whether this line item should be a subscription
Indicates whether this line will be trialed by the customer
The URL to the product image
Selected custom variables for this cart line
CreateCheckoutSessionDto
Request to create a new checkout session.The line items to include in the checkout session
Optional coupon ID to apply a discount
Optional affiliate code to track referrals
Optional URL to redirect to after successful checkout
Optional URL to redirect to if checkout is canceled
Whether to automatically redirect the customer (return_url must be set)
CreateCheckoutSessionLineDto
Represents a line item in a checkout session request.The Flake ID of the product
The quantity of the product (defaults to 1)
Determines whether this line should create a subscription
Indicates whether the product should be trialed
Optional recipient information for gifting
Optional customer ID to gift to
Schema Structure
TheStorefrontSchemas type is derived from the OpenAPI components:
- Cart operations:
CartDto,CartLineDto,CreateCartCheckoutSessionDto - Checkout operations:
CreateCheckoutSessionDto,CheckoutSessionDto - Customer data:
CustomerDto,AuthenticateStorefrontCustomerRequestDto - Product data:
StorefrontProductDto,StorefrontProductPricingDetailsDto - Custom variables:
CartLineCustomVariableDto,StorefrontCustomVariableOptionDto
Type Safety Benefits
Autocomplete in Your IDE
Autocomplete in Your IDE
Access all available schema properties with IntelliSense/autocomplete support.
Compile-Time Validation
Compile-Time Validation
Catch type errors during development before they reach production.
Self-Documenting Code
Self-Documenting Code
Types serve as inline documentation for API request and response structures.
Related Resources
Storefront Client
Learn about Storefront API methods
Management Schemas
Type definitions for Management API