{"id":20571474,"url":"https://github.com/kf99916/ireceipt","last_synced_at":"2026-04-02T01:53:49.584Z","repository":{"id":40979439,"uuid":"113407061","full_name":"kf99916/iReceipt","owner":"kf99916","description":"Generate Taiwan's electronic receipt including QR code, bar code, and XML for National Taxation Bureau","archived":false,"fork":false,"pushed_at":"2023-01-03T19:45:42.000Z","size":550,"stargazers_count":13,"open_issues_count":9,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-14T17:06:51.352Z","etag":null,"topics":["barcode","buyer","national-taxation-bureau","qrcode","receipt","receipt-information","taiwan-electronic-receipt","tax","tax-items","xml"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kf99916.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-07T05:30:49.000Z","updated_at":"2023-09-08T17:33:39.000Z","dependencies_parsed_at":"2023-02-01T09:17:04.193Z","dependency_job_id":null,"html_url":"https://github.com/kf99916/iReceipt","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kf99916%2FiReceipt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kf99916%2FiReceipt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kf99916%2FiReceipt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kf99916%2FiReceipt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kf99916","download_url":"https://codeload.github.com/kf99916/iReceipt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248923766,"owners_count":21183953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["barcode","buyer","national-taxation-bureau","qrcode","receipt","receipt-information","taiwan-electronic-receipt","tax","tax-items","xml"],"created_at":"2024-11-16T05:16:20.036Z","updated_at":"2026-04-02T01:53:49.509Z","avatar_url":"https://github.com/kf99916.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iReceipt\n\nGenerate Taiwan's electronic receipt including QR code, bar code, and XML for National Taxation Bureau. The spec. from National Taxation Bureau is trivial but very complicated and hard to read. iReceipt can save your life and time!!!\n\n[![npm](https://img.shields.io/npm/dt/ireceipt.svg)](https://www.npmjs.com/package/ireceipt)\n[![GitHub stars](https://img.shields.io/github/stars/kf99916/iReceipt.svg)](https://github.com/kf99916/iReceipt/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/kf99916/iReceipt.svg)](https://github.com/kf99916/iReceipt/network)\n[![npm](https://img.shields.io/npm/v/ireceipt.svg)](https://www.npmjs.com/package/ireceipt)\n[![GitHub license](https://img.shields.io/github/license/kf99916/iReceipt.svg)](https://github.com/kf99916/iReceipt/blob/master/LICENSE)\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/kf99916/iReceipt/raw/master/screenshots/ireceipt.png\" alt=\"iReceipt\"\u003e\n\u003c/p\u003e\n\n## Installation\n\n```bash\nnpm install ireceipt --save\n```\n\n### Run in a Browser\n\nJust leverage \u003ca href=\"https://webpack.js.org/\" target=\"_blank\"\u003eWebpack\u003c/a\u003e to bundle `IReceipt` to let `IReceipt` work in a browser.\n\n## Usage\n\n```javascript\nimport IReceipt from 'ireceipt';\n\nconst info = new IReceipt.ReceiptInfo(\n        1234,\n        new Date(),\n        { id: '{{SELLER_ID}}', name: '{{SELLER_NAME}}' },\n        { id: '{{BUYER_ID}}', name: '{{BUYER_NAME}}' },\n        false\n    ),\n    items = [new IReceipt.Item('{{ITEM_DESCRIPTION}}', 3000, 1)],\n    receipt = new IReceipt.Receipt(info, items),\n    AESKey = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];\n\nreceipt\n    .render(AESKey)\n    .then(htmlString =\u003e {\n        const win = window.open();\n        win.document.body.innerHTML = htmlString;\n    })\n    .catch(err =\u003e {\n        window.console.error('err', err);\n    });\n\n// toXmL\nwindow.console.log(receipt.toXML());\n\n// Taiwan Receipt Lottery\n// The format of the list of winners:\n// 53925591  10510LC60123189...\n// 53925591  10510LC60122037...\nconst winnersList = IReceipt.Receipt.parseWinnersList('{{WINNERS_LIST}}');\nwindow.console.log(receipt.isWinning(winnersList));\n```\n\n### Receipt\n\nThe receipt JavaScript object. It owns a `ReceiptInfo`, `Item`s and creates a `Amount` based on items.\n\n`constructor(info, items)`\n\n`info` `ReceiptInfo`  \n`items` array of `Item`\n\n#### Member Methods\n\n`toXML()` Receipt object to xml string.  \n`generateBarCodeString()` generate bar code string.  \n`generateLeftQRCodeString(AESKey)` generate left QR code string including the receipt's information.\n`generateRightQRCodeString()` generate right QR code string including information for all items.  \n`renderRightQRCode()` generate right QR code svg string. return `Promise`.  \n`renderLeftQRCode(AESKey)` generate left QR code svg string. return `Promise`.  \n\n`AESKey` the type is array (see the usage section) and the AES key is applied from National Taxation Bureau. More details: \u003ca href=\"https://pjchender.blogspot.tw/2015/07/qrcodeaes.html\" target=\"_blank\"\u003e取得電子發票QRCODE中AES加密金鑰\u003c/a\u003e\n\n`renderBarCode()`generate bar code svg string. return `Promise`.  \n`render(AESKey)` render Taiwan's electronic receipt. return `Promise`.\n\n`AESKey` refer to `renderLeftQRCode(AESKey)`\n\n### ReceiptInfo\n\nStore the receipt information.\n\n`constructor(number, date, seller, buyer, type, carrier, donationID, orderno)`\n\n`number` receipt number  \n`date` receipt date  \n`seller` seller information, including id and name. (`{ id: '{{SELLER_ID}}', name: '{{SELLER_NAME}}' }`)  \n`buyer` buyer information, including id and name. (`{ id: '{{BUYER_ID}}', name: '{{BUYER_NAME}}' }`)  \n`type` receipt type (default `07`)  \n`carrier` receipt carrier information, including id and type. (`{id: '{{CARRIER_ID}}', type:'CARRIER_TYPE'}`)  \n`donationID` charity's love code (愛心碼)  \n`orderno` order number\n\n### Item\n\nThe product item buyed by buyer.\n\n`constructor(description, unitPrice, sequenceNumber, quantity, taxType)`\n\n`description` product item's description  \n`unitPrice` unit price for a product item  \n`sequenceNumber` sequence number  \n`quantity` quantity of product items (default `1`)  \n`taxType` tax type (default `TaxType.TAX`)\n\n### Amount\n\nStore the amount information.\n\n`constructor(taxItems, freeTaxItems, zeroTaxItems)`\n\n`taxItems` tax items  \n`freeTaxItems` free tax items  \n`zeroTaxItems` zero tax items\n\n### TaxType\n\nTax type enum.\n\n```js\n{\n    TAX: 1,\n    ZERO_TAX: 2,\n    FREE_TAX: 3,\n    SPECIAL_TAX: 4,\n    COMPOUND_TAX: 9\n}\n```\n\n### EncodeType\n\nEncode type for QR code enum.\n\n```js\n{\n    BIG5: 0,\n    UTF8: 1,\n    BASE64: 3\n}\n```\n\n## Reference\n\n* \u003ca href=\"https://www.einvoice.nat.gov.tw/\" target=\"_blank\"\u003eE-invoice Platform (財政部電子發票整合服務平台)\u003c/a\u003e\n* \u003ca href=\"https://www.einvoice.nat.gov.tw/home/DownLoad?fileName=1479449792874_0.6(20161115).pdf\" target=\"_blank\"\u003e電子發票證明聯一維及二維條碼規格說明(V1.6)\u003c/a\u003e\n* \u003ca href=\"https://www.einvoice.nat.gov.tw/home/DownLoad?fileName=1447235507091_0.zip\" target=\"_blank\"\u003e電子發票資料交換標準文件與範例(V3.1.2)\u003c/a\u003e\n* \u003ca href=\"https://pjchender.blogspot.tw/2015/07/qrcodeaes.html\" target=\"_blank\"\u003e取得電子發票QRCODE中AES加密金鑰\u003c/a\u003e\n\n## Author\n\nZheng-Xiang Ke, kf99916@gmail.com\n\n## Contributors\n\nSin-Fong Lyu, kingispeak@gmail.com\n\n## License\n\niReceipt is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkf99916%2Fireceipt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkf99916%2Fireceipt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkf99916%2Fireceipt/lists"}