Skip to main content
The ManagementSchemas export provides TypeScript type definitions for all request and response schemas in the Management API.

Overview

The Management API schemas are automatically generated from the PayNow OpenAPI specification and provide type safety for administrative operations like managing products, orders, customers, and store configuration.
import type { ManagementSchemas } from 'paynow';

type Product = ManagementSchemas['ProductDto'];
type Order = ManagementSchemas['CheckoutDto'];
type Customer = ManagementSchemas['CustomerDto'];

Using Management Schemas

Typing API Responses

Use ManagementSchemas to type data returned from Management API methods:
import { createManagementClient } from 'paynow';
import type { ManagementSchemas } from 'paynow';

const client = createManagementClient({
  storeId: 'your-store-id',
  apiKey: 'your-api-key'
});

const products = await client.products.list();
// products is typed as ManagementSchemas['ProductDto'][]

const order = await client.checkouts.get('checkout-id');
// order is typed as ManagementSchemas['CheckoutDto']

Typing Request Payloads

Type your request payloads for better type safety:
import type { ManagementSchemas } from 'paynow';

const createProductRequest: ManagementSchemas['CreateProductDto'] = {
  name: 'Premium Subscription',
  slug: 'premium-sub',
  description: 'Access to premium features',
  enabled: true,
  price: 999, // $9.99 in cents
  currency: 'usd'
};

await client.products.create(createProductRequest);

Working with Nested Types

Access nested schema types for complex structures:
import type { ManagementSchemas } from 'paynow';

// Affiliate link configuration
type AffiliateLink = ManagementSchemas['AffiliateLinkDto'];
type AffiliateLinkCommission = ManagementSchemas['AffiliateLinkCommissionType'];

const affiliateLink: AffiliateLink = {
  id: '411486491630370816',
  store_id: '411486491630370816',
  wallet_id: 'steam:76561198152492642',
  enabled: true,
  commission_type: 'percentage',
  commission_value: 10,
  discount_type: 'none',
  discount_value: 0
};

Common Management Schemas

ProductDto

Represents a product in your store.
id
string
required
The Flake ID of the product
store_id
string
required
The Flake ID of the store
name
string
required
The name of the product
slug
string
required
The URL-friendly slug of the product
description
string
required
The description of the product
enabled
boolean
required
Whether the product is enabled for purchase
price
number
required
The price in the smallest currency unit (e.g., cents)
currency
string
required
The currency code (e.g., usd, eur, gbp)
image_url
string | null
The URL to the product image
created_at
string
required
ISO 8601 timestamp when the product was created
updated_at
string
required
ISO 8601 timestamp when the product was last updated

CheckoutDto

Represents a completed checkout/order.
id
string
required
The Flake ID of the checkout
store_id
string
required
The Flake ID of the store
customer_id
string
required
The Flake ID of the customer
status
string
required
The checkout status (e.g., completed, pending, canceled)
subtotal_amount
number
required
The subtotal amount in cents
tax_amount
number
required
The tax amount in cents
discount_amount
number
required
The discount amount in cents
total_amount
number
required
The total amount in cents
currency
string
required
The currency code
lines
CheckoutLineDto[]
required
The line items in the checkout

CustomerDto

Represents a customer in your store.
id
string
required
The Flake ID of the customer
store_id
string
required
The Flake ID of the store
email
string | null
The customer’s email address
created_at
string
required
ISO 8601 timestamp when the customer was created
updated_at
string
required
ISO 8601 timestamp when the customer was last updated

AffiliateLinkDto

Represents an affiliate marketing link.
id
string
required
The Flake ID of the affiliate link
store_id
string
required
The Flake ID of the store
wallet_id
string
required
The wallet ID of the affiliate
enabled
boolean
required
Whether the affiliate link is enabled
commission_type
'none' | 'fixed' | 'percentage'
required
The type of commission
commission_value
number
required
The commission value (cents for fixed, percentage for percentage)
discount_type
'none' | 'fixed' | 'percentage'
required
The type of discount offered to customers
discount_value
number
required
The discount value

PayNowError

The standard error response schema. See Error Handling for details.
status
number
required
The HTTP status code (e.g., 400, 404, 500)
code
string
required
The PayNow parseable error code (e.g., bad-request, not-found)
message
string
required
The human-readable error message
trace_id
string | null
A distributed trace ID used for debugging
errors
ValidationError[] | null
An array of validation errors (only present for validation failures)

Schema Structure

The ManagementSchemas type is derived from the OpenAPI components:
import type { components as ManagementComponents } from './generated/management';

export type ManagementSchemas = ManagementComponents['schemas'];
This provides access to all schema definitions in the Management API, including:
  • Product management: ProductDto, CreateProductDto, UpdateProductDto
  • Order management: CheckoutDto, CreateCheckoutSessionDto
  • Customer management: CustomerDto, UpdateCustomerDto
  • Affiliate links: AffiliateLinkDto, CreateAffiliateLinkDto
  • Bans: BanDto, CreateBanDto
  • Coupons: CouponDto, CreateCouponDto
  • Gift cards: GiftCardDto, CreateGiftCardDto
  • Subscriptions: SubscriptionDto, UpdateSubscriptionDto
  • Webhooks: WebhookDto, CreateWebhookDto
  • Store configuration: StoreDto, UpdateStoreDto

Type Safety Benefits

Access all available schema properties with IntelliSense/autocomplete support.
Catch type errors during development before they reach production.
When schemas change, TypeScript will highlight all affected code.
Types serve as inline documentation for API request and response structures.

Enum Types

Many schemas include enum types for better type safety:
import type { ManagementSchemas } from 'paynow';

type CommissionType = ManagementSchemas['AffiliateLinkCommissionType'];
// 'none' | 'fixed' | 'percentage'

type DiscountType = ManagementSchemas['AffiliateLinkDiscountType'];
// 'none' | 'fixed' | 'percentage'

Management Client

Learn about Management API methods

Error Handling

Handle API errors effectively

Storefront Schemas

Type definitions for Storefront API

Webhook Schemas

Type definitions for webhook payloads

Build docs developers (and LLMs) love