{"_id":"@acoriss/payment-gateway","_rev":"5-9582fd694fabee40ea17dc21f87a630b","name":"@acoriss/payment-gateway","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.0":{"name":"@acoriss/payment-gateway","version":"0.1.0","keywords":["payments","sdk","typescript","checkout","acoriss"],"author":{"name":"Acoriss"},"license":"MIT","_id":"@acoriss/payment-gateway@0.1.0","maintainers":[{"name":"theblackman","email":"paskasonga@gmail.com"}],"dist":{"shasum":"304ba6bc6d258d1c5511e2e5092ffec444431ec3","tarball":"https://registry.npmjs.org/@acoriss/payment-gateway/-/payment-gateway-0.1.0.tgz","fileCount":16,"integrity":"sha512-HfAuq17z8NJxllG+LLA4dU03Z2LE/wFlNPPXiPtU9i5iPiyg4pML7ttN6KVeJWI4V/dlWP06/qeBiA2QWkBjjQ==","signatures":[{"sig":"MEUCID5OoJ5z4cv3g0jO5wafGetU3DV8qpHEWMS7xpIm+WdaAiEA6L5K7aupEZ9jTDoyWJBYqqBSmMtm0SkTOUTPI/woihE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47713},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=16"},"gitHead":"e734784b8423d70c50174ce974f437755a13fb52","scripts":{"test":"jest","build":"tsc -p tsconfig.json","clean":"rm -rf dist","prepare":"husky","typecheck":"tsc --noEmit","test:watch":"jest --watch","test:coverage":"jest --coverage","prepublishOnly":"yarn clean && yarn build"},"_npmUser":{"name":"theblackman","email":"paskasonga@gmail.com"},"repository":{"url":"","type":"git"},"_npmVersion":"10.8.2","description":"TypeScript SDK for Acoriss Payment Gateway (sessions API)","directories":{},"lint-staged":{"*.ts":["yarn typecheck","yarn test --bail --findRelatedTests"]},"resolutions":{"js-yaml":"^4.1.1"},"_nodeVersion":"20.18.0","dependencies":{"axios":"^1.7.7"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"29","nock":"^14.0.10","husky":"^9.1.7","ts-jest":"29","typescript":"^5.6.3","@types/jest":"29","@types/node":"^22.7.5","lint-staged":"^16.2.6"},"_npmOperationalInternal":{"tmp":"tmp/payment-gateway_0.1.0_1763175764878_0.05610631200839222","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@acoriss/payment-gateway","version":"0.1.1","keywords":["payments","sdk","typescript","checkout","acoriss"],"author":{"name":"Acoriss"},"license":"MIT","_id":"@acoriss/payment-gateway@0.1.1","maintainers":[{"name":"theblackman","email":"paskasonga@gmail.com"}],"homepage":"https://github.com/Acoriss-RDC/payment-gateway-node-sdk#readme","bugs":{"url":"https://github.com/Acoriss-RDC/payment-gateway-node-sdk/issues"},"dist":{"shasum":"fa294eee73cb2ce3ba474a183e7b54a7357009dd","tarball":"https://registry.npmjs.org/@acoriss/payment-gateway/-/payment-gateway-0.1.1.tgz","fileCount":16,"integrity":"sha512-UwDg0HdpfVHv+vJUC0rjA3qXvXgTRLFDGE8eII/Jw9idN9kXc7ZGPWcnJEiMhyaEpBsZyCe72G2r8bl7/jXORg==","signatures":[{"sig":"MEQCIH9TONuJJgpuceD8/GhJ6fk3ZoUdZ7gBfuHM5/wzAUtnAiAMIlSwBGHho4NUO4BpeQTugD0unDoZeaESEGCAZ9xRug==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47785},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=16"},"gitHead":"e12cf3325696c8b17fc96fffb0854803504129e4","scripts":{"test":"jest","build":"tsc -p tsconfig.json","clean":"rm -rf dist","prepare":"husky","typecheck":"tsc --noEmit","test:watch":"jest --watch","test:coverage":"jest --coverage","prepublishOnly":"yarn clean && yarn build"},"_npmUser":{"name":"theblackman","email":"paskasonga@gmail.com"},"repository":{"url":"git+https://github.com/Acoriss-RDC/payment-gateway-node-sdk.git","type":"git"},"_npmVersion":"10.8.2","description":"TypeScript SDK for Acoriss Payment Gateway (sessions API)","directories":{},"lint-staged":{"*.ts":["yarn typecheck","yarn test --bail --findRelatedTests"]},"resolutions":{"js-yaml":"^4.1.1"},"_nodeVersion":"21.4.0","dependencies":{"axios":"^1.7.7"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"29","nock":"^14.0.10","husky":"^9.1.7","ts-jest":"29","typescript":"^5.6.3","@types/jest":"29","@types/node":"^22.7.5","lint-staged":"^16.2.6"},"_npmOperationalInternal":{"tmp":"tmp/payment-gateway_0.1.1_1763217544812_0.980205851280977","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@acoriss/payment-gateway","version":"0.1.2","keywords":["payments","sdk","typescript","checkout","acoriss"],"author":{"name":"Acoriss"},"license":"MIT","_id":"@acoriss/payment-gateway@0.1.2","maintainers":[{"name":"theblackman","email":"paskasonga@gmail.com"}],"dist":{"shasum":"ce94c5edf65fdcae1f83b2a9a5f151fbea36c204","tarball":"https://registry.npmjs.org/@acoriss/payment-gateway/-/payment-gateway-0.1.2.tgz","fileCount":20,"integrity":"sha512-sNc2MixYfAYOuUc+nCipfap0kaGHskZlsyArSEbsGJGjANdpBGVFO9SC3sozgVK/C9tFORbKXvw0yJxSvVckWg==","signatures":[{"sig":"MEQCIDBMwvYKzZ/P5SDNalQA/qpYG97XyLS/CKQTIjPV1Zd3AiATSq7Uh2I9ReKU1G0Ql2O+1CpHCAL+E5Pp4sOxhW1N3A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47365},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=16"},"scripts":{"test":"jest","build":"tsc -p tsconfig.json","clean":"rm -rf dist","prepare":"husky","typecheck":"tsc --noEmit","test:watch":"jest --watch","test:coverage":"jest --coverage","prepublishOnly":"yarn clean && yarn build"},"_npmUser":{"name":"theblackman","email":"paskasonga@gmail.com"},"repository":{"url":"https://github.com/Acoriss-RDC/payment-gateway-node-sdk","type":"git"},"description":"TypeScript SDK for Acoriss Payment Gateway (sessions API)","directories":{},"lint-staged":{"*.ts":["yarn typecheck","yarn test --bail --findRelatedTests"]},"resolutions":{"js-yaml":"^4.1.1"},"dependencies":{"axios":"^1.7.7"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"29","nock":"^14.0.10","husky":"^9.1.7","ts-jest":"29","typescript":"^5.6.3","@types/jest":"29","@types/node":"^22.7.5","lint-staged":"^16.2.6"},"_npmOperationalInternal":{"tmp":"tmp/payment-gateway_0.1.2_1765195079350_0.1008870100493724","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@acoriss/payment-gateway","version":"0.1.3","keywords":["payments","sdk","typescript","checkout","acoriss"],"author":{"name":"Acoriss"},"license":"MIT","_id":"@acoriss/payment-gateway@0.1.3","maintainers":[{"name":"theblackman","email":"paskasonga@gmail.com"}],"dist":{"shasum":"6feba0d968374c59ecdaa33c2df56f9aee0293be","tarball":"https://registry.npmjs.org/@acoriss/payment-gateway/-/payment-gateway-0.1.3.tgz","fileCount":20,"integrity":"sha512-fioLvPJ8Dd9qdOOk5Rg3mNr07daMIKRjxtNBinUMdooM0yRy7Mpac0tUosEhQdngH/vItW/PVzICwULzt3JSaQ==","signatures":[{"sig":"MEQCIFR7fQy6+85QxJv73O1Wxy360Xc3TITuB1cRhWzUGV2nAiBB9md0gFPv7uqvriNx3S+iZi3CZFP8nHhHryg3dcRhQg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":47292},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=16"},"scripts":{"test":"jest","build":"tsc -p tsconfig.json","clean":"rm -rf dist","prepare":"husky","typecheck":"tsc --noEmit","test:watch":"jest --watch","test:coverage":"jest --coverage","prepublishOnly":"yarn clean && yarn build"},"_npmUser":{"name":"theblackman","email":"paskasonga@gmail.com"},"repository":{"url":"https://github.com/Acoriss-RDC/payment-gateway-node-sdk","type":"git"},"description":"TypeScript SDK for Acoriss Payment Gateway (sessions API)","directories":{},"lint-staged":{"*.ts":["yarn typecheck","yarn test --bail --findRelatedTests"]},"resolutions":{"js-yaml":"^4.1.1"},"dependencies":{"axios":"^1.7.7"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"29","nock":"^14.0.10","husky":"^9.1.7","ts-jest":"29","typescript":"^5.6.3","@types/jest":"29","@types/node":"^22.7.5","lint-staged":"^16.2.6"},"_npmOperationalInternal":{"tmp":"tmp/payment-gateway_0.1.3_1765281752663_0.2816255609431808","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@acoriss/payment-gateway","version":"0.1.5","description":"TypeScript SDK for Acoriss Payment Gateway (sessions API)","license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","publishConfig":{"access":"public"},"engines":{"node":">=16"},"scripts":{"clean":"rm -rf dist","build":"tsc -p tsconfig.json","typecheck":"tsc --noEmit","test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage","prepare":"husky","prepublishOnly":"yarn clean && yarn build"},"repository":{"type":"git","url":"git+https://github.com/Acoriss-RDC/payment-gateway-node-sdk.git"},"keywords":["payments","sdk","typescript","checkout","acoriss"],"author":{"name":"Acoriss"},"dependencies":{"axios":"^1.7.7"},"resolutions":{"js-yaml":"^4.1.1"},"devDependencies":{"@types/jest":"29","@types/node":"^22.7.5","husky":"^9.1.7","jest":"29","lint-staged":"^16.2.6","nock":"^14.0.10","ts-jest":"29","typescript":"^5.6.3"},"lint-staged":{"*.ts":["yarn typecheck","yarn test --bail --findRelatedTests"]},"_id":"@acoriss/payment-gateway@0.1.5","gitHead":"4c7ade418778d4ef7455be1d801c862f71d368e4","bugs":{"url":"https://github.com/Acoriss-RDC/payment-gateway-node-sdk/issues"},"homepage":"https://github.com/Acoriss-RDC/payment-gateway-node-sdk#readme","_nodeVersion":"21.4.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-KCavL2T/wSoKzr1nea7z2ZJqaqZdsJAiCHVd2yfcOykught9N1Um0YZptGUBzQGjbbKNpa3qcjgwY7aGnQ6e+Q==","shasum":"43d873a33ea309bed141dc623668e554007cbe7e","tarball":"https://registry.npmjs.org/@acoriss/payment-gateway/-/payment-gateway-0.1.5.tgz","fileCount":16,"unpackedSize":51258,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFZjwAWBX8kBpy58s3NjiCIr710Hi3uN4b8AbjQDc2HEAiEA6KTg5ZlB0ErKcYdvq/QLlnZebCVMh8ICPzCej0wom40="}]},"_npmUser":{"name":"theblackman","email":"paskasonga@gmail.com"},"directories":{},"maintainers":[{"name":"theblackman","email":"paskasonga@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/payment-gateway_0.1.5_1765878994093_0.8506040080075596"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-15T03:02:44.471Z","modified":"2025-12-16T09:56:34.484Z","0.1.0":"2025-11-15T03:02:45.059Z","0.1.1":"2025-11-15T14:39:05.025Z","0.1.2":"2025-12-08T11:57:59.496Z","0.1.3":"2025-12-09T12:02:32.802Z","0.1.5":"2025-12-16T09:56:34.241Z"},"author":{"name":"Acoriss"},"license":"MIT","keywords":["payments","sdk","typescript","checkout","acoriss"],"repository":{"type":"git","url":"git+https://github.com/Acoriss-RDC/payment-gateway-node-sdk.git"},"description":"TypeScript SDK for Acoriss Payment Gateway (sessions API)","maintainers":[{"name":"theblackman","email":"paskasonga@gmail.com"}],"readme":"# Acoriss Payment Gateway SDK (Node.js / TypeScript)\n\nA lightweight TypeScript SDK to create payment sessions with the Acoriss payment gateway.\n\n## Install\n\nUses yarn:\n\n```bash\nyarn add @acoriss/payment-gateway\n```\n\n## Quick start\n\n```ts\nimport { PaymentGatewayClient } from '@acoriss/payment-gateway';\n\nconst client = new PaymentGatewayClient({\n  apiKey: process.env.PG_API_KEY!,\n  // Option 1: provide `apiSecret` to use default HMAC-SHA256(body, secret) signature\n  apiSecret: process.env.PG_API_SECRET!,\n  // or Option 2: provide a custom signer via { signer } or per-call signatureOverride\n  environment: 'sandbox', // or 'live'\n});\n\nconst session = await client.createSession({\n  amount: 5000,\n  currency: 'USD',\n  customer: { email: 'john@example.com', name: 'John Doe', phone: '+1234567890' },\n  description: 'Payment for Order #1234',\n  serviceId: 'SV001', // Optional: categorize the payment\n  callbackUrl: 'https://example.com/api/callback',\n  cancelUrl: 'https://example.com/cancel',\n  successUrl: 'https://example.com/success',\n  transactionId: 'order_1234',\n  services: [\n    { name: 'express_delivery', price: 1500, description: 'Express delivery service', quantity: 1 },\n  ],\n});\n\nconsole.log('Checkout URL:', session.checkoutUrl);\n```\n\n### Retrieve Payment Status\n\n```ts\nconst payment = await client.getPayment('pay_1234567890');\n\nconsole.log('Payment Status:', payment.status); // 'P' | 'S' | 'C'\nconsole.log('Amount:', payment.amount);\nconsole.log('Expired:', payment.expired);\nconsole.log('Services:', payment.services);\n```\n\nPayment status values:\n- `'P'` - Pending: Payment is awaiting completion\n- `'S'` - Succeeded: Payment was successful\n- `'C'` - Canceled: Payment was canceled or failed\n\n## Service Categorization\n\nYou can optionally categorize payments using the `serviceId` field. The `serviceId` is obtained from your Acoriss dashboard:\n\n```ts\nconst session = await client.createSession({\n  amount: 2500,\n  currency: 'EUR',\n  customer: { email: 'jane@example.com', name: 'Jane Smith' },\n  serviceId: 'SV123', // Service ID from your dashboard\n  description: 'Premium subscription renewal',\n});\n\n// The serviceId is included in the response\nconsole.log('Service ID:', session.serviceId); // 'SV123'\n\n// And also when retrieving the payment later\nconst payment = await client.getPayment(session.id);\nconsole.log('Service ID:', payment.serviceId); // 'SV123'\n```\n\n**How to get Service IDs:**\n1. Log into your Acoriss dashboard\n2. Navigate to Services or Payment Categories\n3. Copy the Service ID (format: `SV###`) for the service you want to associate with the payment\n\nThis allows you to categorize payments for better organization, reporting, and analysis in your dashboard.\n\n## Signature\n\nBy default the SDK computes `X-SIGNATURE` as `HMAC-SHA256(body, apiSecret)` if you provide `apiSecret`.\n\nIf your gateway uses a different signing algorithm, you can:\n\n- Provide a custom signer:\n\n```ts\nconst client = new PaymentGatewayClient({\n  apiKey: '...',\n  signer: { sign: (raw) => myCustomSignature(raw) },\n});\n```\n\n- Or override per call:\n\n```ts\nclient.createSession(payload, { signatureOverride: 'precomputed-signature' });\n```\n\n## Configuration\n\n- apiKey: string (required)\n- apiSecret?: string (optional; enables default HMAC-SHA256 signature)\n- signer?: { sign(body: string): string } (optional; custom signer)\n- environment?: 'sandbox' | 'live' (default: sandbox)\n- baseURL?: string (optional override of base URL)\n- timeoutMs?: number (default: 15000)\n\n## API\n\n### Methods\n\n#### `createSession(payload, opts?)`\n\nCreates a new payment session.\n\n**Parameters:**\n- `payload: PaymentSessionRequest` - Session details (amount, currency, customer, etc.)\n- `opts?: { signatureOverride?: string }` - Optional signature override\n\n**Returns:** `Promise<PaymentSessionResponse>` - Session details with checkout URL\n\n#### `getPayment(paymentId, opts?)`\n\nRetrieves payment status and details by payment ID.\n\n**Parameters:**\n- `paymentId: string` - The payment ID (e.g., 'pay_1234567890')\n- `opts?: { signatureOverride?: string }` - Optional signature override\n\n**Returns:** `Promise<RetrievePaymentResponse>` - Payment details including status, services, and customer info\n\n## Types\n\nSee TypeScript declarations for `PaymentSessionRequest` and `PaymentSessionResponse` in `src/types.ts`.\n\n## Error handling\n\nErrors throw `APIError` with `status`, `data`, and `headers` from the HTTP response when available.\n\n## Development\n\n```bash\n# install deps\nyarn\n\n# run tests\nyarn test\n\n# run tests in watch mode\nyarn test:watch\n\n# run tests with coverage\nyarn test:coverage\n\n# type-check\nyarn typecheck\n\n# build to dist/\nyarn build\n```\n\n### Pre-commit Hooks\n\nThis project uses Husky and lint-staged to ensure code quality before commits:\n\n- **lint-staged**: Runs typecheck and tests on staged TypeScript files\n- **pre-commit hook**: Runs the full test suite, type checking, and build\n\nThe pre-commit hook will automatically run when you commit changes. If any check fails, the commit will be blocked until the issues are fixed.\n\nTo bypass the pre-commit hook (not recommended), use:\n```bash\ngit commit --no-verify\n```\n\n### Testing\n\nThe project uses Jest with ts-jest for testing. Tests are located in `src/__tests__/` and cover:\n\n- **client.test.ts**: Client initialization, signature generation, session creation, error handling\n- **errors.test.ts**: APIError class functionality\n- **types.test.ts**: TypeScript type definitions and interfaces\n\nCoverage threshold is set to 80% for branches, functions, lines, and statements.","readmeFilename":"README.md","homepage":"https://github.com/Acoriss-RDC/payment-gateway-node-sdk#readme","bugs":{"url":"https://github.com/Acoriss-RDC/payment-gateway-node-sdk/issues"}}