This guide covers everything you need to know about installing and configuring the PayNow TypeScript SDK in your project.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.
Requirements
The SDK requires:- Node.js 16 or later
- TypeScript 4.5 or later (for TypeScript projects)
Package installation
Install the SDK using your preferred package manager:@types package is needed.
Importing the SDK
The SDK exports two main functions for creating API clients:Available exports
The SDK provides the following exports:| Export | Description |
|---|---|
createStorefrontClient | Creates a client for storefront operations |
createManagementClient | Creates a client for management operations |
isPayNowError | Type guard for PayNowError instances |
ManagementSchemas | TypeScript types for management API schemas |
StorefrontSchemas | TypeScript types for storefront API schemas |
WebhookPayloadSchemas | TypeScript types for webhook payloads |
Basic setup
Storefront client
Create a storefront client with just your store ID:Management client
Create a management client with your store ID and API key:Advanced configuration
Both client creation functions accept an optional configuration object as their last parameter. This object follows the AxiosCreateAxiosDefaults interface, allowing you to customize the HTTP client behavior.
Custom timeout
Set a custom timeout for API requests:Custom headers
Add custom headers to all requests:Base URL override
Override the default API base URL (useful for testing):The default base URL is
https://api.paynow.gg. You typically don’t need to override this unless you’re testing against a staging environment.Request interceptors
While the SDK doesn’t directly expose the Axios instance, you can configure interceptors through the options:TypeScript configuration
For optimal TypeScript support, ensure yourtsconfig.json includes:
Using type definitions
The SDK exports TypeScript types for all API schemas:Environment variables
For better security and configuration management, store your credentials in environment variables:Next steps
Quickstart
Make your first API calls with the SDK
API reference
Explore all available endpoints and methods