{"id":21237708,"url":"https://github.com/siamak/zarinpal-checkout","last_synced_at":"2025-04-30T10:12:42.967Z","repository":{"id":57405250,"uuid":"56984101","full_name":"siamak/zarinpal-checkout","owner":"siamak","description":"☼ Simple implementation of ZarinPal JavaScript.","archived":false,"fork":false,"pushed_at":"2024-09-28T07:29:41.000Z","size":36,"stargazers_count":79,"open_issues_count":8,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-30T10:12:35.162Z","etag":null,"topics":["checkout","promises","zarinpal"],"latest_commit_sha":null,"homepage":"http://zarinpal.com","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/siamak.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-24T17:14:13.000Z","updated_at":"2025-01-25T18:14:56.000Z","dependencies_parsed_at":"2024-06-18T19:51:55.836Z","dependency_job_id":"421dd6e3-d084-4c00-8419-aee55df9f8d8","html_url":"https://github.com/siamak/zarinpal-checkout","commit_stats":{"total_commits":37,"total_committers":10,"mean_commits":3.7,"dds":"0.29729729729729726","last_synced_commit":"f9ea07108ecd581c3e3ab7e0069c710c4c11164c"},"previous_names":["siamakmokhtari/zarinpal-checkout"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siamak%2Fzarinpal-checkout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siamak%2Fzarinpal-checkout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siamak%2Fzarinpal-checkout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siamak%2Fzarinpal-checkout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siamak","download_url":"https://codeload.github.com/siamak/zarinpal-checkout/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251683355,"owners_count":21626953,"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":["checkout","promises","zarinpal"],"created_at":"2024-11-21T00:20:11.328Z","updated_at":"2025-04-30T10:12:42.944Z","avatar_url":"https://github.com/siamak.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZarinPal Checkout: [![Build Status](https://travis-ci.org/siamak/zarinpal-checkout.svg?branch=master)](https://travis-ci.org/siamak/zarinpal-checkout)\n\n[ZarinPal Checkout](https://www.zarinpal.com/) implementation in Node.JS\n\n- Easy to Use\n- Promises/A+ Compatible\n- Sandboxing\n\n## 🕹 Usage\n\nInstall the package from `npm` or `yarn` and require it in your Node project:\n\n```bash\nnpm install zarinpal-checkout\n# or\nyarn add zarinpal-checkout\n```\n\n```javascript\nconst ZarinpalCheckout = require(\"zarinpal-checkout\");\n// or\nimport ZarinPalCheckout from \"zarinpal-checkout\";\n```\n\nThen create an instance:\n\n```javascript\n/**\n * Create ZarinPal\n * @param {String} `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` [Merchant ID]\n * @param {Boolean} false [toggle `Sandbox` mode]\n * @param {String} `IRR` or `IRT` [Currency - For default `IRT`]\n */\nconst zarinpal = ZarinpalCheckout.create(\n  \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\",\n  false,\n  \"IRT\"\n);\n```\n\n## Typescript Definitions\n\n```bash\nnpm install @types/zarinpal-checkout\n# or\nyarn add @types/zarinpal-checkout\n```\n\nDefinitions are currently maintained in the [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/zarinpal-checkout) repo.\n\n## 📢 API\n\n### ★ Payment Request:\n\n```javascript\n/**\n * PaymentRequest [module]\n * @return {String} URL [Payement Authority]\n */\nzarinpal\n  .PaymentRequest({\n    Amount: \"1000\", // In Tomans\n    CallbackURL: \"https://your-safe-api/example/zarinpal/validate\",\n    Description: \"A Payment from Node.JS\",\n    Email: \"hi@siamak.work\",\n    Mobile: \"09120000000\",\n  })\n  .then((response) =\u003e {\n    if (response.status === 100) {\n      console.log(response.url);\n    }\n  })\n  .catch((err) =\u003e {\n    console.error(err);\n  });\n```\n\n### ★ Payment Verification:\n\n```javascript\nzarinpal\n  .PaymentVerification({\n    Amount: \"1000\", // In Tomans\n    Authority: \"000000000000000000000000000000000000\",\n  })\n  .then((response) =\u003e {\n    if (response.status !== 100) {\n      console.log(\"Empty!\");\n    } else {\n      console.log(`Verified! Ref ID: ${response.RefID}`);\n    }\n  })\n  .catch((err) =\u003e {\n    console.error(err);\n  });\n```\n\n### ★ Unverified Transactions:\n\n```javascript\nzarinpal.UnverifiedTransactions().then(response =\u003e\n  if (response.status === 100) {\n    console.log(response.authorities);\n  }\n}).catch(err =\u003e {\n  console.error(err);\n});\n```\n\n### ★ Refresh Authority:\n\n```javascript\nzarinpal\n  .RefreshAuthority({\n    Authority: \"000000000000000000000000000000000000\",\n    Expire: \"1800\",\n  })\n  .then((response) =\u003e {\n    if (response.status === 100) {\n      console.log(response.status);\n    }\n  })\n  .catch((err) =\u003e {\n    console.error(err);\n  });\n```\n\n### 🍦🍦🍦 [DEMO: ZarinPal Express checkout](https://github.com/siamakmokhtari/zarinpal-express-checkout).\n\n---\n\n## 🔆 To-Do\n\n- [ ] Add Extra mode for API.\n- [x] Promises/A+\n- [x] Unit testing `mocha`.\n\n## 👋 Contribution\n\nContributions are welcome. Please submit PRs or just file an issue if you see something broken or in\nneed of improving.\n\n## 🍀 License\n\nThis software is released under the [MIT License](http://siamak.mit-license.org).\n\n```\nThe MIT License (MIT)\n\nCopyright (c) 2015-2017 Siamak Mokhtari s.mokhtari75@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiamak%2Fzarinpal-checkout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiamak%2Fzarinpal-checkout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiamak%2Fzarinpal-checkout/lists"}