{"_id":"@astra-pay/sdk","_rev":"2-e56bf66dfda16f798097e26faae83679","name":"@astra-pay/sdk","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@astra-pay/sdk","version":"1.0.0","keywords":["astrapay","sdk","crypto","payments","typescript","api"],"license":"MIT","_id":"@astra-pay/sdk@1.0.0","maintainers":[{"name":"astra-pay","email":"noreply@byastra.ai"}],"dist":{"shasum":"0d7548b52f1b0c591ec841e6d3411138566dd6f5","tarball":"https://registry.npmjs.org/@astra-pay/sdk/-/sdk-1.0.0.tgz","fileCount":30,"integrity":"sha512-o8WPc9wyEymOm4zxkxqoegdiiEp01ryTgOzEOM7RIPiJZD/YH/sZIhpIFfhQY0kElxtGTzDhp5n6SELhH6LfUA==","signatures":[{"sig":"MEYCIQCa1TDvjyPh0s38fznn93DOPGsnTjF0TNukbxIdFit/cAIhALOCwteSEiYLcY2XiYwMXfFbKV5C2RRCTb1IwYWi+sGd","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33598},"main":"./build/index.js","type":"module","types":"./build/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./build/index.d.ts","import":"./build/index.js"}},"gitHead":"6f5e7dd44ae7ee52037a5e82a511eb9b12837e49","scripts":{"dev":"tsc --watch","build":"tsc","prepublishOnly":"yarn build"},"_npmUser":{"name":"astra-pay","email":"noreply@byastra.ai"},"_npmVersion":"10.9.2","description":"Official TypeScript SDK for the AstraPay crypto payment API","directories":{},"_nodeVersion":"22.17.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.7.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.0_1775225027753_0.8075030653754247","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@astra-pay/sdk","version":"1.1.0","description":"Official TypeScript SDK for the AstraPay crypto payment API","type":"module","main":"./build/index.js","types":"./build/index.d.ts","exports":{".":{"types":"./build/index.d.ts","import":"./build/index.js"}},"scripts":{"build":"tsc","dev":"tsc --watch","prepublishOnly":"yarn build"},"engines":{"node":">=18.0.0"},"keywords":["astrapay","sdk","crypto","payments","typescript","api"],"license":"MIT","devDependencies":{"@types/node":"^22.0.0","typescript":"^5.7.0"},"_id":"@astra-pay/sdk@1.1.0","gitHead":"a5b5ef1a4ce701be19484b5285407ca5e7787cdc","_nodeVersion":"22.17.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-ZnGIQYthJdJBhsvKtaUCaN4MLVVmFcpW+6dVoMbIIA5yRe98YA92/S37o55WVn8AMhudwisa3E5M8HC3dkRaZA==","shasum":"b77c3b6c1a43140cafbfe679f91fdd3e31ecaace","tarball":"https://registry.npmjs.org/@astra-pay/sdk/-/sdk-1.1.0.tgz","fileCount":30,"unpackedSize":33931,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDAobECNSe+FiZ7txKBlT0xe9x6Fznity5R+3lu+cPNDQIgOF++L/KJC5abLARVfx0r1LKDn8xa1yYmleQE4IyoHaw="}]},"_npmUser":{"name":"astra-pay","email":"noreply@byastra.ai"},"directories":{},"maintainers":[{"name":"astra-pay","email":"noreply@byastra.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.1.0_1776585608614_0.020522888667447337"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-03T14:03:47.629Z","modified":"2026-04-19T08:00:08.856Z","1.0.0":"2026-04-03T14:03:47.920Z","1.1.0":"2026-04-19T08:00:08.749Z"},"license":"MIT","keywords":["astrapay","sdk","crypto","payments","typescript","api"],"description":"Official TypeScript SDK for the AstraPay crypto payment API","maintainers":[{"name":"astra-pay","email":"noreply@byastra.ai"}],"readme":"# @astra-pay/sdk\n\nOfficial TypeScript SDK for the [AstraPay](https://pay.byastra.ai) crypto payment API.\n\n## Installation\n\n```bash\nnpm install @astra-pay/sdk\n# or\nyarn add @astra-pay/sdk\n```\n\n## Quick Start\n\n```typescript\nimport { AstraPayClient } from \"@astra-pay/sdk\";\n\nconst client = new AstraPayClient(\"ap_live_...\");\n\n// Create a payment\nconst payment = await client.payments.create({\n  amount: 25,\n  token: \"USDC\",\n  network: \"BASE\",\n});\nconsole.log(payment.checkout_url);\n\n// List payments\nconst { data, meta } = await client.payments.list({ status: \"PENDING\" });\n\n// Create a product\nconst product = await client.products.create({\n  name: \"Pro Plan\",\n  price: 49,\n  currency_type: \"FIAT\",\n});\n\n// Register a webhook\nconst webhook = await client.webhooks.create({\n  url: \"https://example.com/webhook\",\n  events: [\"payment.completed\"],\n});\nconsole.log(webhook.secret); // Store this securely\n```\n\n## API Reference\n\n### `new AstraPayClient(apiKey, options?)`\n\n| Option    | Default                     | Description     |\n| --------- | --------------------------- | --------------- |\n| `baseUrl` | `https://apipay.byastra.ai` | API base URL    |\n| `prefix`  | `/v1`                       | API path prefix |\n\n### Payments\n\n| Method                           | Description              |\n| -------------------------------- | ------------------------ |\n| `client.payments.create(params)` | Create a payment         |\n| `client.payments.get(id)`        | Get payment by ID        |\n| `client.payments.list(params?)`  | List payments            |\n| `client.payments.cancel(id)`     | Cancel a pending payment |\n\n### Products\n\n| Method                               | Description       |\n| ------------------------------------ | ----------------- |\n| `client.products.create(params)`     | Create a product  |\n| `client.products.get(id)`            | Get product by ID |\n| `client.products.list()`             | List all products |\n| `client.products.update(id, params)` | Update a product  |\n| `client.products.delete(id)`         | Delete a product  |\n\n### Webhooks\n\n| Method                               | Description       |\n| ------------------------------------ | ----------------- |\n| `client.webhooks.create(params)`     | Create a webhook  |\n| `client.webhooks.get(id)`            | Get webhook by ID |\n| `client.webhooks.list()`             | List all webhooks |\n| `client.webhooks.update(id, params)` | Update a webhook  |\n| `client.webhooks.delete(id)`         | Delete a webhook  |\n\n## Error Handling\n\n```typescript\nimport { AstraPayClient, AstraPayError } from \"@astra-pay/sdk\";\n\ntry {\n  await client.payments.get(\"invalid-id\");\n} catch (err) {\n  if (err instanceof AstraPayError) {\n    console.log(err.status); // 404\n    console.log(err.code); // \"NOT_FOUND\"\n    console.log(err.message); // \"Payment not found\"\n  }\n}\n```\n\n## Requirements\n\n- Node.js >= 18.0.0 (uses native `fetch`)\n- Zero runtime dependencies\n\n## License\n\nMIT\n","readmeFilename":"README.md"}