{"_id":"@be.izi/card-tokenization","_rev":"2-a22b0bd50d4a2f4228b7fb26eab7ca65","name":"@be.izi/card-tokenization","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@be.izi/card-tokenization","version":"0.1.0","license":"UNLICENSED","_id":"@be.izi/card-tokenization@0.1.0","maintainers":[{"name":"be.iziadmin","email":"suporte@izipaynow.com"}],"dist":{"shasum":"4fc4cf67fbcf78601d057010e41d64f1b7af27de","tarball":"https://registry.npmjs.org/@be.izi/card-tokenization/-/card-tokenization-0.1.0.tgz","fileCount":7,"integrity":"sha512-dPfeKsOotrHgj3/8EBsotcbUQPOsn8q4p9ZvsaX/ovF3pC04o22hPpMMfLPhi+ge133gAqH7CuUDPL1/uR7clA==","signatures":[{"sig":"MEUCIEBn9cgemNe3NYg/C3Y0kT6W0NWi5nNGuk2d/yJv17vbAiEA8mOrV7nQqkUIyB2uEg5XRFKg+RQHSrucvdGhLNUHMeE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":91834},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=24.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"1c004d855b48fbd61b8c59bb9bf9f2a2727018c2","scripts":{"lint":"eslint .","test":"vitest run","build":"tsup","check":"npm run lint && npm run format:check && npm run typecheck && npm test && npm run build && npm run bundle:check && npm run test:consumers && npm run pack:check","format":"prettier --write .","dev:bench":"npm run build && node scripts/serve-dev-bench.mjs","typecheck":"tsc --noEmit","pack:check":"npm pack --dry-run --cache .npm-cache","bundle:check":"node scripts/check-bundle.mjs","format:check":"prettier --check .","test:browser":"npm run build && playwright test","prepublishOnly":"npm run check","test:consumers":"tsc -p tests/consumers/tsconfig.json && node tests/consumers/import-esm.mjs && node tests/consumers/require-cjs.cjs","test:browser:hom":"node scripts/check-hom-smoke-env.mjs && npm run build && playwright test --project=chromium --grep @hom"},"_npmUser":{"name":"be.iziadmin","email":"suporte@izipaynow.com"},"_npmVersion":"11.17.0","description":"Browser SDK for Beizi card tokenization.","directories":{},"sideEffects":false,"_nodeVersion":"26.4.0","dependencies":{"card-validator":"10.0.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"npm@11.17.0","devDependencies":{"tsup":"8.5.1","eslint":"10.8.1","vitest":"4.1.10","prettier":"3.9.6","@eslint/js":"10.0.1","typescript":"5.9.3","@types/node":"26.2.0","@playwright/test":"1.62.1","typescript-eslint":"8.67.0"},"_npmOperationalInternal":{"tmp":"tmp/card-tokenization_0.1.0_1787346828996_0.9572290331526112","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@be.izi/card-tokenization","version":"0.1.1","description":"Browser SDK for Beizi card tokenization.","license":"UNLICENSED","repository":{"type":"git","url":"git+https://github.com/bankizi/beizi-card-tokenization.git"},"homepage":"https://github.com/bankizi/beizi-card-tokenization#readme","bugs":{"url":"https://github.com/bankizi/beizi-card-tokenization/issues"},"type":"module","sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"publishConfig":{"access":"public"},"engines":{"node":">=24.0.0"},"packageManager":"npm@11.17.0","scripts":{"build":"tsup","bundle:check":"node scripts/check-bundle.mjs","check":"npm run lint && npm run format:check && npm run typecheck && npm test && npm run build && npm run bundle:check && npm run test:consumers && npm run pack:check","dev:bench":"npm run build && node scripts/serve-dev-bench.mjs","format":"prettier --write .","format:check":"prettier --check .","lint":"eslint .","pack:check":"npm pack --dry-run --cache .npm-cache","prepublishOnly":"npm run check","test":"vitest run","test:browser":"npm run build && playwright test","test:browser:hom":"node scripts/check-hom-smoke-env.mjs && npm run build && playwright test --project=chromium --grep @hom","test:consumers":"tsc -p tests/consumers/tsconfig.json && node tests/consumers/import-esm.mjs && node tests/consumers/require-cjs.cjs","typecheck":"tsc --noEmit"},"devDependencies":{"@eslint/js":"10.0.1","@playwright/test":"1.62.1","@types/node":"26.2.0","eslint":"10.8.1","prettier":"3.9.6","tsup":"8.5.1","typescript":"5.9.3","typescript-eslint":"8.67.0","vitest":"4.1.10"},"dependencies":{"card-validator":"10.0.4"},"gitHead":"1c004d855b48fbd61b8c59bb9bf9f2a2727018c2","_id":"@be.izi/card-tokenization@0.1.1","_nodeVersion":"26.4.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-HtlTEryYPF7eRfyVQgLb/uXTCgNcHnT3EkaGflfPLpJ5sIu0WWzyulENUKfr7884SXStLw5i4zi9KFqd2OBCqA==","shasum":"f394ceb084d6c5629c0e8bc031b3b67c39ddfb57","tarball":"https://registry.npmjs.org/@be.izi/card-tokenization/-/card-tokenization-0.1.1.tgz","fileCount":7,"unpackedSize":93831,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDEymtjtcc+QtDloVjojthIe/Gpv4qKzWzpgFXSSVDQrwIgNH6NKuFLmGKptDFSgdQtBQi2Ft89aZ0A2KSOvJkP2Ew="}]},"_npmUser":{"name":"be.iziadmin","email":"suporte@izipaynow.com"},"directories":{},"maintainers":[{"name":"be.iziadmin","email":"suporte@izipaynow.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/card-tokenization_0.1.1_1787579450729_0.1640690854000726"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-21T21:13:48.813Z","modified":"2026-08-24T13:50:51.097Z","0.1.0":"2026-08-21T21:13:49.189Z","0.1.1":"2026-08-24T13:50:50.887Z"},"license":"UNLICENSED","description":"Browser SDK for Beizi card tokenization.","maintainers":[{"name":"be.iziadmin","email":"suporte@izipaynow.com"}],"readme":"# @be.izi/card-tokenization\n\nSDK para tokenizar cartões de pagamento no navegador usando a infraestrutura da\nBeizi. O pacote é independente de framework e oferece tipos para TypeScript.\n\nOs dados do cartão são enviados diretamente do navegador para o serviço de\ntokenização. Sua aplicação recebe um `cardToken`, que deve ser enviado ao backend para\nrealizar a operação de pagamento.\n\n## Instalação\n\n```bash\nnpm install @be.izi/card-tokenization\n```\n\n## Antes de começar\n\nVocê precisa de:\n\n- uma chave de tokenização fornecida pela Beizi;\n- a origem da aplicação cadastrada para essa chave;\n- um ambiente de navegador. A tokenização não pode ser executada no servidor.\n\n## Uso básico\n\n```ts\nimport { Beizi } from '@be.izi/card-tokenization';\n\nconst beizi = Beizi.create({\n  tokenizationKey: 'sua_chave_de_tokenizacao',\n  environment: 'HOM',\n});\n\nconst result = await beizi.tokenize({\n  number: '4111 1111 1111 1111',\n  holder: 'MARIA DA SILVA',\n  expiryMonth: '12',\n  expiryYear: '2030',\n  cvv: '123',\n});\n\n// Envie somente o token ao seu backend.\nawait sendToYourBackend({ cardToken: result.cardToken });\n```\n\nO resultado da tokenização contém:\n\n| Campo            | Descrição                                                         |\n| ---------------- | ----------------------------------------------------------------- |\n| `cardToken`      | Token que representa os dados do cartão na operação de pagamento. |\n| `brand`          | Bandeira identificada: `VISA`, `MASTERCARD`, `ELO` ou `AMEX`.     |\n| `lastFourDigits` | Quatro últimos dígitos do cartão.                                 |\n| `expiresAt`      | Data e hora de expiração do token.                                |\n\n## Cobrança pública\n\nQuando a tokenização estiver associada a uma cobrança pública, informe o contexto com\no identificador da cobrança:\n\n```ts\nconst result = await beizi.tokenize({\n  number: '4111 1111 1111 1111',\n  holder: 'MARIA DA SILVA',\n  expiryMonth: '12',\n  expiryYear: '2030',\n  cvv: '123',\n  context: {\n    type: 'PUBLIC_CHARGE',\n    chargeId: 'identificador_da_cobranca',\n  },\n});\n```\n\nOmita `context` nas tokenizações vinculadas diretamente à conta.\n\n## Tratamento de erros\n\nFalhas de validação, configuração ou comunicação são representadas por\n`TokenizationError`:\n\n```ts\nimport { Beizi, TokenizationError } from '@be.izi/card-tokenization';\n\ntry {\n  const result = await beizi.tokenize(card);\n  await sendToYourBackend({ cardToken: result.cardToken });\n} catch (error) {\n  if (error instanceof TokenizationError) {\n    console.error(error.code, error.field);\n\n    if (error.retryable) {\n      // Permita que a pessoa tente novamente. Não faça retry automático.\n    }\n  }\n}\n```\n\nCada erro expõe:\n\n| Propriedade | Descrição                                                           |\n| ----------- | ------------------------------------------------------------------- |\n| `code`      | Código estável que identifica a falha.                              |\n| `field`     | Campo inválido, quando a falha está associada a um campo do cartão. |\n| `retryable` | Indica se uma nova tentativa manual pode ser oferecida.             |\n\nCódigos disponíveis:\n\n| Código                         | Significado                                                |\n| ------------------------------ | ---------------------------------------------------------- |\n| `BROWSER_ENVIRONMENT_REQUIRED` | A tokenização foi chamada fora do navegador.               |\n| `INVALID_HOLDER`               | Nome do titular inválido.                                  |\n| `INVALID_CARD_NUMBER`          | Número do cartão inválido.                                 |\n| `INVALID_EXPIRY`               | Mês ou ano de validade inválido.                           |\n| `INVALID_CVV`                  | Código de segurança inválido.                              |\n| `INVALID_CONTEXT`              | Contexto de tokenização inválido.                          |\n| `UNSUPPORTED_CARD_BRAND`       | Bandeira não suportada.                                    |\n| `INVALID_TOKENIZATION_KEY`     | Chave de tokenização inválida.                             |\n| `ORIGIN_NOT_ALLOWED`           | Origem da aplicação não autorizada.                        |\n| `RATE_LIMITED`                 | Limite temporário de requisições atingido.                 |\n| `TIMEOUT`                      | O serviço não respondeu dentro do tempo esperado.          |\n| `NETWORK_ERROR`                | Não foi possível acessar o serviço de tokenização.         |\n| `SERVICE_UNAVAILABLE`          | Serviço temporariamente indisponível ou resposta inválida. |\n\n`RATE_LIMITED`, `TIMEOUT`, `NETWORK_ERROR` e `SERVICE_UNAVAILABLE` possuem\n`retryable: true`.\n\n## Ambientes\n\n| Valor | Uso                       |\n| ----- | ------------------------- |\n| `HOM` | Integração e homologação. |\n| `PRD` | Produção.                 |\n\nNão existe ambiente padrão: informe sempre `environment` ao criar o cliente.\n\n## Segurança\n\n- Nunca registre ou persista PAN, CVV, nome do titular, chave de tokenização ou\n  `cardToken`.\n- Não envie os dados brutos do cartão ao seu backend. Envie somente `cardToken`.\n- Use apenas dados sintéticos em testes, exemplos e ferramentas de diagnóstico.\n- Não faça retry automático de uma tokenização.\n\nConsulte a [política de segurança](./SECURITY.md) para mais orientações.\n","readmeFilename":"README.md","homepage":"https://github.com/bankizi/beizi-card-tokenization#readme","repository":{"type":"git","url":"git+https://github.com/bankizi/beizi-card-tokenization.git"},"bugs":{"url":"https://github.com/bankizi/beizi-card-tokenization/issues"}}