Documentation Index
Fetch the complete documentation index at: https://mintlify.com/paynow-gg/typescript-sdk/llms.txt
Use this file to discover all available pages before exploring further.
The Products API allows you to create, retrieve, update, and delete products in your store.
Do NOT use the Management API to display products on your storefront. Use the Storefront API instead, which is optimized for public product listings and doesn’t require authentication.
List Products
Retrieve all products in your store.
const response = await client.products.getProducts({
params: {
limit: 50,
after: 'product-id', // Optional: for pagination
asc: false // Optional: sort order
}
});
console.log(response.data); // Array of ProductDto
Parameters
limit (optional): Maximum number of items to return (default varies by endpoint)
after (optional): Return items after this ID (cursor-based pagination)
before (optional): Return items before this ID
asc (optional): Sort order - true for ascending, false for descending
Response
Returns an array of product objects with full product details including pricing, variants, and configuration.
Get Product
Retrieve a specific product by ID.
const response = await client.products.getProduct({
path: {
productId: '1234567890'
}
});
console.log(response.data); // ProductDto
Parameters
productId (required): The ID of the product to retrieve
Create Product
Create a new product in your store.
Creating dynamic products via the Management API without prior approval is prohibited and will result in store deactivation per the User Agreement.
const response = await client.products.createProduct({
data: {
name: 'Premium Package',
description: 'A premium package with exclusive items',
price: 1999, // Price in cents (USD 19.99)
enabled: true,
stock_limited: false,
// ... additional product fields
}
});
console.log(response.data); // Created ProductDto
Request Body
The request body should contain product details. Key fields include:
name (required): Product name
description: Product description
price (required): Price in smallest currency unit (cents)
enabled: Whether the product is visible and purchasable
stock_limited: Whether to track inventory
stock_amount: Available quantity (if stock_limited is true)
Refer to the CreateProductDto type for complete field definitions.
Update Product
Update an existing product.
const response = await client.products.updateProduct({
path: {
productId: '1234567890'
},
data: {
name: 'Updated Premium Package',
price: 2499, // Updated price
enabled: true
}
});
console.log(response.data); // Updated ProductDto
Parameters
productId (required): The ID of the product to update
data (required): Fields to update (partial update supported)
Delete Product
Delete a product from your store.
await client.products.deleteProduct({
path: {
productId: '1234567890'
}
});
// Returns 204 No Content on success
Parameters
productId (required): The ID of the product to delete
Update Product Sort Order
Update the display order of products in your store.
await client.products.updateProductSortOrder({
data: {
product_ids: [
'1234567890',
'0987654321',
'1122334455'
]
}
});
Request Body
product_ids (required): Array of product IDs in desired display order
Regional Pricing
Manage region-specific pricing for products.
Get Product Pricing Regions
const response = await client.regionalPricing.getProductPricingRegions({
path: {
productId: '1234567890'
}
});
console.log(response.data); // Array of pricing regions
Set Product Pricing Region Override
await client.regionalPricing.setProductPricingRegionOverride({
path: {
productId: '1234567890',
regionId: 'EU'
},
data: {
price: 1899 // Region-specific price in cents
}
});
Example: Complete Product Management
import { createManagementClient, isPayNowError } from '@paynow-gg/typescript-sdk';
const client = createManagementClient(
process.env.STORE_ID!,
process.env.API_KEY!
);
async function manageProducts() {
try {
// Create a new product
const newProduct = await client.products.createProduct({
data: {
name: 'VIP Rank',
description: 'Unlock VIP perks on our server',
price: 999,
enabled: true,
stock_limited: false
}
});
console.log('Created product:', newProduct.data.id);
// Update the product
const updated = await client.products.updateProduct({
path: { productId: newProduct.data.id },
data: {
description: 'Unlock VIP perks including special commands and cosmetics'
}
});
console.log('Updated product:', updated.data.name);
// List all products
const products = await client.products.getProducts({
params: { limit: 100 }
});
console.log(`Total products: ${products.data.length}`);
} catch (error) {
if (isPayNowError(error)) {
console.error('API Error:', error.response?.data);
} else {
throw error;
}
}
}
manageProducts();
- Orders - View product sales and orders
- Analytics - Track product performance