{"_id":"3tpay-sdk","_rev":"2-c711b63411fafe3db691a144965091de","name":"3tpay-sdk","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"3tpay-sdk","version":"0.1.0","author":{"name":"nnlgsakib"},"license":"MIT","_id":"3tpay-sdk@0.1.0","maintainers":[{"name":"nnlgsakibmind","email":"nlgarts@outlook.com"}],"dist":{"shasum":"835f1f333186e0474c70d7f6ea4d6b8c7d24de33","tarball":"https://registry.npmjs.org/3tpay-sdk/-/3tpay-sdk-0.1.0.tgz","fileCount":24,"integrity":"sha512-rrlwwIoimdR5WILDbU3ez2s6M5G70qKLzIwyu/rfcT4JfppTj/gihnwrLgkec5uX0IYEAF8rQuR+sr7138ixZQ==","signatures":[{"sig":"MEUCIGv8NOKOUcnsRQbIWSjdLthvmJJjUST1l5oMbf1AXfSlAiEA7FqITOW5aSfFx2DL+3CLwFEh51K7cwHQNXG+bZHYAak=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":156698},"main":"dist/index.js","husky":{"hooks":{"pre-commit":"tsdx lint"}},"module":"dist/tpay-sdk.esm.js","engines":{"node":">=10"},"gitHead":"d5c052e97f35b7ce63caeb2849c290068dee57d6","scripts":{"lint":"tsdx lint","size":"size-limit","test":"tsdx test","build":"tsdx build","start":"tsdx watch","analyze":"size-limit --why","prepare":"tsdx build"},"typings":"dist/index.d.ts","_npmUser":{"name":"nnlgsakibmind","email":"nlgarts@outlook.com"},"prettier":{"semi":true,"printWidth":80,"singleQuote":true,"trailingComma":"es5"},"size-limit":[{"path":"dist/tpay-sdk.cjs.production.min.js","limit":"10 KB"},{"path":"dist/tpay-sdk.esm.js","limit":"10 KB"}],"_npmVersion":"10.2.4","description":"Welcome to the `3tpay-sdk`! This is a lightweight, TypeScript-based Software Development Kit (SDK) designed to make integrating with the **Crypto Payment API** (hosted at `https://payment.web3twenty.com/v2/api`) a breeze. Whether you're a merchant looking","directories":{},"_nodeVersion":"20.11.0","dependencies":{"axios":"^1.9.0"},"_hasShrinkwrap":false,"devDependencies":{"tsdx":"^0.14.1","husky":"^9.1.7","tslib":"^2.8.1","size-limit":"^11.2.0","typescript":"^5.8.3","@size-limit/preset-small-lib":"^11.2.0"},"peerDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/3tpay-sdk_0.1.0_1748932414230_0.129573741371505","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"version":"0.1.1","license":"MIT","main":"dist/index.js","typings":"dist/index.d.ts","engines":{"node":">=10"},"scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test","lint":"tsdx lint","prepare":"tsdx build","size":"size-limit","analyze":"size-limit --why"},"peerDependencies":{},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"name":"3tpay-sdk","author":{"name":"nnlgsakib"},"module":"dist/tpay-sdk.esm.js","size-limit":[{"path":"dist/tpay-sdk.cjs.production.min.js","limit":"10 KB"},{"path":"dist/tpay-sdk.esm.js","limit":"10 KB"}],"devDependencies":{"@size-limit/preset-small-lib":"^11.2.0","husky":"^9.1.7","size-limit":"^11.2.0","tsdx":"^0.14.1","tslib":"^2.8.1","typescript":"^5.8.3"},"dependencies":{"axios":"^1.9.0"},"_id":"3tpay-sdk@0.1.1","gitHead":"d5c052e97f35b7ce63caeb2849c290068dee57d6","description":"Welcome to the `3tpay-sdk`! This is a lightweight, TypeScript-based Software Development Kit (SDK) designed to make integrating with the **Crypto Payment API** (hosted at `https://payment.web3twenty.com/v2/api`) a breeze. Whether you're a merchant looking","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-Y0vn+HAID0+63bcK0szWqI/AXJLEjSf8Z0TQJZco1RKqtMIz+5PAS60H3JL/LNBOjdJMVEwiEeNhseunFlc3Ug==","shasum":"fc3a0a001ed65b21852cb6fd83b86bf278e08aca","tarball":"https://registry.npmjs.org/3tpay-sdk/-/3tpay-sdk-0.1.1.tgz","fileCount":24,"unpackedSize":150014,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEde+YJmbH3FCvVl95Mt70IZay/f5TCg10WAeRQlUVAXAiEA9IBC5PHAiWPvIhY5Tm9vrhAFat0NeMxN6dcCCVGM+Ys="}]},"_npmUser":{"name":"nnlgsakibmind","email":"nlgarts@outlook.com"},"directories":{},"maintainers":[{"name":"nnlgsakibmind","email":"nlgarts@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/3tpay-sdk_0.1.1_1749016908870_0.5571549239413844"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-03T06:33:34.121Z","modified":"2025-06-04T06:01:49.237Z","0.1.0":"2025-06-03T06:33:34.405Z","0.1.1":"2025-06-04T06:01:49.057Z"},"author":{"name":"nnlgsakib"},"license":"MIT","description":"Welcome to the `3tpay-sdk`! This is a lightweight, TypeScript-based Software Development Kit (SDK) designed to make integrating with the **Crypto Payment API** (hosted at `https://payment.web3twenty.com/v2/api`) a breeze. Whether you're a merchant looking","maintainers":[{"name":"nnlgsakibmind","email":"nlgarts@outlook.com"}],"readme":"# 3tpay-sdk\n\nWelcome to the `3tpay-sdk`! This is a lightweight, TypeScript-based Software Development Kit (SDK) designed to make integrating with the **Crypto Payment API** (hosted at `https://payment.web3twenty.com/v2/api`) a breeze. Whether you're a merchant looking to create invoices, manage licenses, or track transactions, or an admin needing to oversee system-wide data, this SDK has you covered. It’s published on npm as `3tpay-sdk`, so you can easily add it to your project and start building.\n\nThis SDK is production-ready, type-safe, and built for simplicity. It supports trial access (via trial hashes), full merchant licenses, and admin API keys, giving you flexibility for different use cases. With detailed examples, robust error handling, and TypeScript support, you’ll be up and running in no time.\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Getting Started](#getting-started)\n  - [Configuration](#configuration)\n  - [Authentication Modes](#authentication-modes)\n- [Merchant SDK](#merchant-sdk)\n  - [License Management](#license-management)\n    - [Generate a License](#generate-a-license)\n    - [Generate a Trial Hash](#generate-a-trial-hash)\n    - [Renew a License](#renew-a-license)\n    - [Get License Details](#get-license-details)\n  - [Merchant Operations](#merchant-operations)\n    - [Register a Merchant](#register-a-merchant)\n    - [Get Merchant Transactions](#get-merchant-transactions)\n    - [Get Merchant Invoices](#get-merchant-invoices)\n    - [Get Merchant Metrics](#get-merchant-metrics)\n  - [Invoice Operations](#invoice-operations)\n    - [Create an Invoice](#create-an-invoice)\n    - [Get an Invoice](#get-an-invoice)\n    - [Verify a Micro-Payment](#verify-a-micro-payment)\n- [Admin SDK](#admin-sdk)\n  - [Get System Metrics](#get-system-metrics)\n  - [Get All Merchants](#get-all-merchants)\n  - [Get All Invoices](#get-all-invoices)\n  - [Get All Transactions](#get-all-transactions)\n- [Error Handling](#error-handling)\n- [Testing the SDK](#testing-the-sdk)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Features\n\nHere’s what the `3tpay-sdk` brings to the table:\n\n- **Merchant SDK**: Tools for merchants to manage licenses, register stores, create and track invoices, verify micro-payments, and get transaction metrics.\n- **Admin SDK**: Admin tools to monitor system metrics, list merchants, invoices, and transactions with filtering options.\n- **Authentication Options**:\n  - **Trial Hash**: Test the API with a temporary trial hash.\n  - **Full License**: Secure merchant operations with a license and user key.\n  - **API Key**: Admin access with an API key.\n- **Type Safety**: Full TypeScript support with type definitions for all inputs and responses.\n- **Simple API**: Easy-to-use methods like `merchant.createInvoice` or `admin.getMetrics`.\n- **Customizable Config**: Set your API URL and credentials however you need.\n- **Error Handling**: Custom error classes for clear debugging (e.g., `UnauthorizedError`).\n- **Lightweight**: Only depends on `axios` for HTTP requests, keeping it lean.\n\n## Installation\n\nTo start using the `3tpay-sdk`, install it from npm. Here are the commands:\n\n```bash\nnpm install 3tpay-sdk\n```\n\nOr if you prefer Yarn:\n\n```bash\nyarn add 3tpay-sdk\n```\n\nYou’ll need Node.js (version 14 or higher). The SDK works in both browser and server environments since it uses `axios` under the hood.\n\n## Getting Started\n\n### Configuration\n\nThe SDK uses a `Config` class to handle settings like the API base URL and authentication credentials. You’ll create a config instance and pass it to either the `MerchantSDK` or `AdminSDK` to get started.\n\nThe config supports these options:\n- `baseUrl`: The API endpoint (defaults to `https://payment.web3twenty.com/v2/api`).\n- `apiKey`: For admin operations.\n- `license` and `userKey`: For merchant operations with a full license.\n- `trialHash`: For trial access to merchant features.\n\nHere’s how to set it up:\n\n```typescript\nimport { Config, MerchantSDK, AdminSDK } from '3tpay-sdk';\n\n// Merchant config with a trial hash (for testing)\nconst trialConfig = Config.getInstance({\n  trialHash: 'your-trial-hash-here',\n});\n\n// Merchant config with a full license\nconst merchantConfig = Config.getInstance({\n  license: 'your-license-here',\n  userKey: 'your-user-key-here',\n});\n\n// Admin config with an API key\nconst adminConfig = Config.getInstance({\n  apiKey: 'your-api-key-here',\n});\n\n// Create SDK instances\nconst merchantWithTrial = new MerchantSDK(trialConfig.getConfig());\nconst merchantWithLicense = new MerchantSDK(merchantConfig.getConfig());\nconst admin = new AdminSDK(adminConfig.getConfig());\n```\n\nYou can update the config later if needed:\n\n```typescript\ntrialConfig.updateConfig({ trialHash: 'new-trial-hash-here' });\n```\n\n### Authentication Modes\n\nThe SDK supports three ways to authenticate:\n\n1. **Trial Hash**: Use a `trialHash` to test merchant features without a full license.\n2. **Full License**: Use a `license` and `userKey` for secure, long-term merchant access.\n3. **API Key**: Use an `apiKey` for admin operations.\n\nThe SDK handles the authentication headers for you based on what you provide in the config.\n\n## Merchant SDK\n\nThe `MerchantSDK` is where most developers will spend their time. It lets you manage licenses, register merchants, handle invoices, and more. Let’s break it down with examples.\n\n### License Management\n\n#### Generate a License\n\nNeed a full license? Use `generateLicense` with an email and the number of months you want it to last.\n\n```typescript\nimport { MerchantSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({ trialHash: 'your-trial-hash' });\nconst merchant = new MerchantSDK(config.getConfig());\n\nasync function generateNewLicense() {\n  try {\n    const response = await merchant.generateLicense('user@example.com', 6);\n    console.log('New License:', response.license); // e.g., \"lic-123\"\n    console.log('User Key:', response.userKey); // e.g., \"key-456\"\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\ngenerateNewLicense();\n```\n\n#### Generate a Trial Hash\n\nWant to test the SDK first? Generate a trial hash with `generateTrialHash`.\n\n```typescript\nimport { MerchantSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({}); // No auth needed to generate trial hash\nconst merchant = new MerchantSDK(config.getConfig());\n\nasync function getTrialHash() {\n  try {\n    const response = await merchant.generateTrialHash();\n    console.log('Trial Hash:', response.trialHash); // e.g., \"trial-abc789\"\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\ngetTrialHash();\n```\n\n#### Renew a License\n\nTo extend an existing license, use `renewLicense` with your current `license`, `userKey`, and the number of extra months.\n\n```typescript\nimport { MerchantSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({\n  license: 'lic-123',\n  userKey: 'key-456',\n});\nconst merchant = new MerchantSDK(config.getConfig());\n\nasync function renewMyLicense() {\n  try {\n    const response = await merchant.renewLicense('lic-123', 'key-456', 3);\n    console.log('Renewed:', response.success); // true\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\nrenewMyLicense();\n```\n\n#### Get License Details\n\nCheck the status of a license (e.g., expiration date) with `getLicenseDetails`.\n\n```typescript\nimport { MerchantSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({\n  license: 'lic-123',\n  userKey: 'key-456',\n});\nconst merchant = new MerchantSDK(config.getConfig());\n\nasync function checkLicense() {\n  try {\n    const details = await merchant.getLicenseDetails('lic-123', 'key-456');\n    console.log('End Date:', details.endDate); // e.g., \"2025-03-01T00:00:00Z\"\n    console.log('Time Left:', details.remainingTime); // e.g., \"5 months\"\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\ncheckLicense();\n```\n\n### Merchant Operations\n\n#### Register a Merchant\n\nTo set up a new merchant, provide a `storeName` and `masterWalletAddress`.\n\n```typescript\nimport { MerchantSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({ trialHash: 'trial-abc789' });\nconst merchant = new MerchantSDK(config.getConfig());\n\nasync function registerNewMerchant() {\n  const merchantData = {\n    storeName: 'CoolStore',\n    masterWalletAddress: '0x1234567890abcdef1234567890abcdef12345678',\n  };\n  try {\n    const response = await merchant.registerMerchant(merchantData);\n    console.log('Merchant ID:', response.merchantId); // e.g., \"merch-001\"\n    console.log('Wallet:', response.masterWalletAddress); // \"0x123...\"\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\nregisterNewMerchant();\n```\n\n#### Get Merchant Transactions\n\nFetch a merchant’s transactions with filters like `page`, `limit`, `currency`, and `timeRange`.\n\n```typescript\nimport { MerchantSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({ trialHash: 'trial-abc789' });\nconst merchant = new MerchantSDK(config.getConfig());\n\nasync function fetchTransactions() {\n  try {\n    const transactions = await merchant.getTransactions('merch-001', {\n      page: 1,\n      limit: 5,\n      currency: 'USDT',\n      timeRange: 'weekly',\n      sortBy: 'timestamp',\n      sortOrder: 'desc',\n    });\n    console.log('Transactions:', transactions.data); // Array of transaction objects\n    console.log('Pagination:', transactions.pagination); // e.g., { page: 1, limit: 5, total: 25, totalPages: 5 }\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\nfetchTransactions();\n```\n\n#### Get Merchant Invoices\n\nGet a list of invoices for a merchant with filters like `status` and `timeRange`.\n\n```typescript\nimport { MerchantSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({ trialHash: 'trial-abc789' });\nconst merchant = new MerchantSDK(config.getConfig());\n\nasync function fetchInvoices() {\n  try {\n    const invoices = await merchant.getInvoices('merch-001', {\n      page: 1,\n      limit: 10,\n      status: 'paid',\n      timeRange: 'monthly',\n      sortBy: 'amount',\n      sortOrder: 'asc',\n    });\n    console.log('Invoices:', invoices.data); // Array of invoice objects\n    console.log('Pagination:', invoices.pagination); // e.g., { page: 1, limit: 10, total: 30, totalPages: 3 }\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\nfetchInvoices();\n```\n\n#### Get Merchant Metrics\n\nSee a merchant’s stats (e.g., total payments, fees) with an optional `timeRange`.\n\n```typescript\nimport { MerchantSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({ trialHash: 'trial-abc789' });\nconst merchant = new MerchantSDK(config.getConfig());\n\nasync function fetchMetrics() {\n  try {\n    const metrics = await merchant.getMetrics('merch-001', 'monthly');\n    console.log('Total Payments:', metrics.totalPayments); // e.g., 5000\n    console.log('Total Fees:', metrics.totalFees); // e.g., 250\n    console.log('Transaction Count:', metrics.transactionCount); // e.g., 100\n    console.log('Invoice Count:', metrics.invoiceCount); // e.g., 75\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\nfetchMetrics();\n```\n\n### Invoice Operations\n\n#### Create an Invoice\n\nCreate a new invoice with details like `amount`, `currency`, and URLs for success/failure.\n\n```typescript\nimport { MerchantSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({ trialHash: 'trial-abc789' });\nconst merchant = new MerchantSDK(config.getConfig());\n\nasync function createNewInvoice() {\n  const invoiceData = {\n    merchantId: 'merch-001',\n    amount: 50,\n    currency: 'USDT',\n    blockchain: 'mind',\n    expirationMinutes: 30,\n    success_url: 'https://mystoresite.com/success',\n    failed_url: 'https://mystoresite.com/failed',\n    ipn_url: 'https://mystoresite.com/webhook', // Optional instant payment notification\n  };\n  try {\n    const invoice = await merchant.createInvoice(invoiceData);\n    console.log('Invoice ID:', invoice.invoiceId); // e.g., \"inv-789\"\n    console.log('Payment Address:', invoice.disposableAddress); // e.g., \"0x...\"\n    console.log('Pay URL:', invoice.pay_url); // e.g., \"https://payment.web3twenty.com/pay?data=...\"\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\ncreateNewInvoice();\n```\n\n#### Get an Invoice\n\nRetrieve details about an invoice by its `invoiceId`.\n\n```typescript\nimport { MerchantSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({ trialHash: 'trial-abc789' });\nconst merchant = new MerchantSDK(config.getConfig());\n\nasync function fetchInvoice() {\n  try {\n    const invoice = await merchant.getInvoice('inv-789');\n    console.log('Status:', invoice.status); // e.g., \"pending\"\n    console.log('Amount:', invoice.amount); // 50\n    console.log('Currency:', invoice.currency); // \"USDT\"\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\nfetchInvoice();\n```\n\n#### Verify a Micro-Payment\n\nVerify a micro-payment with the `invoiceId`, `txHash`, and `memo`.\n\n```typescript\nimport { MerchantSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({ trialHash: 'trial-abc789' });\nconst merchant = new MerchantSDK(config.getConfig());\n\nasync function verifyPayment() {\n  const paymentData = {\n    invoiceId: 'inv-789',\n    txHash: '0xabcdef1234567890abcdef1234567890abcdef12',\n    memo: 'micro-payment-001',\n  };\n  try {\n    const response = await merchant.verifyMicroPayment(paymentData);\n    console.log('Verification:', response); // API-specific response\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\nverifyPayment();\n```\n\n## Admin SDK\n\nThe `AdminSDK` is for admin users who need to manage the entire platform. It requires an `apiKey` for authentication.\n\n### Get System Metrics\n\nGet an overview of the system, like total merchants and payments.\n\n```typescript\nimport { AdminSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({ apiKey: 'your-api-key-here' });\nconst admin = new AdminSDK(config.getConfig());\n\nasync function fetchSystemMetrics() {\n  try {\n    const metrics = await admin.getSystemMetrics();\n    console.log('Total Merchants:', metrics.totalMerchants); // e.g., 15\n    console.log('Total Invoices:', metrics.totalInvoices); // e.g., 150\n    console.log('Total Payments:', metrics.totalPayments); // e.g., 7500\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\nfetchSystemMetrics();\n```\n\n### Get All Merchants\n\nList all merchants with pagination and sorting options.\n\n```typescript\nimport { AdminSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({ apiKey: 'your-api-key-here' });\nconst admin = new AdminSDK(config.getConfig());\n\nasync function fetchAllMerchants() {\n  try {\n    const merchants = await admin.getAllMerchants({\n      page: 1,\n      limit: 10,\n      sortBy: 'storeName',\n      sortOrder: 'asc',\n    });\n    console.log('Merchants:', merchants.data); // Array of merchant objects\n    console.log('Pagination:', merchants.pagination); // e.g., { page: 1, limit: 10, total: 15, totalPages: 2 }\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\nfetchAllMerchants();\n```\n\n### Get All Invoices\n\nList all invoices with filters like `currency` and `status`.\n\n```typescript\nimport { AdminSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({ apiKey: 'your-api-key-here' });\nconst admin = new AdminSDK(config.getConfig());\n\nasync function fetchAllInvoices() {\n  try {\n    const invoices = await admin.getAllInvoices({\n      page: 1,\n      limit: 10,\n      currency: 'USDT',\n      status: 'paid',\n    });\n    console.log('Invoices:', invoices.data); // Array of invoice objects\n    console.log('Pagination:', invoices.pagination); // e.g., { page: 1, limit: 10, total: 50, totalPages: 5 }\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\nfetchAllInvoices();\n```\n\n### Get All Transactions\n\nList all transactions with filters like `timeRange` and `status`.\n\n```typescript\nimport { AdminSDK } from '3tpay-sdk';\n\nconst config = Config.getInstance({ apiKey: 'your-api-key-here' });\nconst admin = new AdminSDK(config.getConfig());\n\nasync function fetchAllTransactions() {\n  try {\n    const transactions = await admin.getAllTransactions({\n      page: 1,\n      limit: 10,\n      timeRange: 'monthly',\n      status: 'confirmed',\n    });\n    console.log('Transactions:', transactions.data); // Array of transaction objects\n    console.log('Pagination:', transactions.pagination); // e.g., { page: 1, limit: 10, total: 100, totalPages: 10 }\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n}\n\nfetchAllTransactions();\n```\n\n## Error Handling\n\nThe SDK includes custom errors to make debugging easier. Here are some common ones:\n\n- `UnauthorizedError`: Missing or invalid credentials (401).\n- `InvalidLicenseError`: Problem with your license (403).\n- `BadRequestError`: Invalid input (400).\n- `NotFoundError`: Resource not found (404).\n\nHere’s how to handle them:\n\n```typescript\nimport { MerchantSDK, UnauthorizedError, BadRequestError } from '3tpay-sdk';\n\nconst config = Config.getInstance({ trialHash: 'trial-abc789' });\nconst merchant = new MerchantSDK(config.getConfig());\n\nasync function tryCreatingInvoice() {\n  const invoiceData = { merchantId: 'merch-001', amount: 50, currency: 'USDT', blockchain: 'mind', expirationMinutes: 30 };\n  try {\n    const invoice = await merchant.createInvoice(invoiceData);\n    console.log('Invoice created:', invoice.invoiceId);\n  } catch (error) {\n    if (error instanceof UnauthorizedError) {\n      console.error('Auth failed:', error.message);\n    } else if (error instanceof BadRequestError) {\n      console.error('Bad input:', error.message);\n    } else {\n      console.error('Unknown error:', error.message);\n    }\n  }\n}\n\ntryCreatingInvoice();\n```\n\n## Testing the SDK\n\nThe SDK comes with tests. Run them with:\n\n```bash\nnpm test\n```\n\nOr with Yarn:\n\n```bash\nyarn test\n```\n\nSet up a mock server or local API instance for full test coverage.\n\n## Contributing\n\nWant to help improve the SDK? Here’s how:\n\n1. Fork the repo.\n2. Create a branch for your changes.\n3. Add tests for your updates.\n4. Submit a pull request with a clear explanation.\n\nMake sure your code follows the SDK’s style and passes all tests.\n\n## License\n\nThe `3tpay-sdk` is released under the MIT License. Check the [LICENSE](LICENSE) file for details.\n\n---\n\nHappy coding! This README has everything you need to integrate the `3tpay-sdk` smoothly, with examples you can paste and play with right away. If you need more help, feel free to reach out!","readmeFilename":"README.md"}