{"id":15364173,"url":"https://github.com/posquit0/node-iamporter","last_synced_at":"2025-06-14T14:38:24.452Z","repository":{"id":9923573,"uuid":"63767983","full_name":"posquit0/node-iamporter","owner":"posquit0","description":":rocket: A REST API client for I'mport","archived":false,"fork":false,"pushed_at":"2023-10-31T17:02:54.000Z","size":119,"stargazers_count":62,"open_issues_count":12,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-04T13:42:36.979Z","etag":null,"topics":["credit-card","es6","i-mport","iamport","korea","node","pay","payment","pg","promise","subscription"],"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/posquit0.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}},"created_at":"2016-07-20T09:19:31.000Z","updated_at":"2024-10-15T06:13:25.000Z","dependencies_parsed_at":"2022-08-07T05:15:15.894Z","dependency_job_id":"8b512032-2d71-48c6-8791-9fd7e5dd610c","html_url":"https://github.com/posquit0/node-iamporter","commit_stats":{"total_commits":107,"total_committers":2,"mean_commits":53.5,"dds":0.04672897196261683,"last_synced_commit":"ae0abcd3c2ab94e001e7fdb5678fadc0330cbe7e"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/posquit0/node-iamporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posquit0%2Fnode-iamporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posquit0%2Fnode-iamporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posquit0%2Fnode-iamporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posquit0%2Fnode-iamporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posquit0","download_url":"https://codeload.github.com/posquit0/node-iamporter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posquit0%2Fnode-iamporter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259833195,"owners_count":22918859,"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":["credit-card","es6","i-mport","iamport","korea","node","pay","payment","pg","promise","subscription"],"created_at":"2024-10-01T13:10:28.533Z","updated_at":"2025-06-14T14:38:24.412Z","avatar_url":"https://github.com/posquit0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003ca href=\"https://github.com/posquit0/node-iamporter\" title=\"Iamporter.js\"\u003e\n    \u003cimg alt=\"Iamporter.js\" src=\"https://avatars3.githubusercontent.com/u/11437969\" width=\"180px\" height=\"180px\" /\u003e\n  \u003c/a\u003e\n  \u003cbr /\u003e\n  Iamporter\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  A REST API client for I'mport\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://circleci.com/gh/posquit0/node-iamporter\"\u003e\n    \u003cimg alt=\"CircleCI\" src=\"https://circleci.com/gh/posquit0/node-iamporter.svg?style=shield\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/posquit0/node-iamporter\"\u003e\n    \u003cimg src=\"https://coveralls.io/repos/github/posquit0/node-iamporter/badge.svg\" alt='Coverage Status' /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://badge.fury.io/js/iamporter\"\u003e\n    \u003cimg alt=\"npm version\" src=\"https://badge.fury.io/js/iamporter.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/iamporter\"\u003e\n    \u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/dt/iamporter.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://david-dm.org/posquit0/node-iamporter\"\u003e\n    \u003cimg alt=\"npm\" src=\"https://img.shields.io/david/posquit0/node-iamporter.svg?style=flat-square\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://opensource.org/licenses/mit-license.php\"\u003e\n    \u003cimg alt=\"MIT Licence\" src=\"https://badges.frapsoft.com/os/mit/mit.svg?v=103\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/ellerbrock/open-source-badge/\"\u003e\n    \u003cimg alt=\"Open Source Love\" src=\"https://badges.frapsoft.com/os/v1/open-source.svg?v=103\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\n**Iamporter**는 [아임포트](http://iamport.kr/)에서 제공하는 REST API를 쉽게 활용하기 위하여 작성된 Node.js 클라이언트 입니다.\n\n- 아임포트는 국내 PG사와의간편한 연동을 제공하는 서비스입니다.\n- 이용 중 발생한 문제에 대하여 책임지지 않습니다.\n- 최초 작성은 자동차 렌트 플랫폼 [CARPLAT](https://www.carplat.co.kr)에서 사용하기 위하여 작성되었습니다.\n\n## Features\n\n- Written in ES6 Syntax\n- [Promise](http://www.html5rocks.com/ko/tutorials/es6/promises/) Support\n- Exception Handling with a custom error class `IamporterError`\n\n\n## Installation\n\n```bash\n$ npm install iamporter\n```\n\n\n## Specification\n\n- 모든 API 요청은 Promise를 반환합니다.\n\n### Fulfilled \n\n- API 요청이 성공적으로 수행된 경우 다음과 같은 형식의 데이터를 반환합니다.\n\n```js\n{\n  \"status\": 200, // HTTP STATUS CODE\n  \"message\": \"\", // 아임포트 API 응답 메시지 혹은 Iamporter 정의 메시지\n  \"data\": {}, // 아임포트 API 응답 데이터\n  \"raw\": {} // 아임포트 API RAW DATA\n}\n```\n\n### Rejected\n\n- API 요청을 성공적으로 수행하지 못한 경우 항상 `IamporterError` 에러를 반환합니다.\n\n```js\niamporter.paySubscription(...)\n  .catch((err) =\u003e {\n    console.log(err.status); // HTTP STATUS CODE\n    console.log(err.message); // 아임포트 API 응답 메시지 혹은 Iamporter 정의 메시지\n    console.log(err.data); // 아임포트 API 응답 데이터\n    console.log(err.raw); // 아임포트 API RAW DATA\n  });\n```\n\n\n## Usage\n\n### Import \u0026 Create an Instance\n\n- `iamporter` 패키지는 `Iamporter`와 `IamporterError` 두 클래스를 제공합니다.\n\n```node\nconst { Iamporter, IamporterError } = require('iamporter');\n\n// For Testing (테스트용 API KEY와 SECRET 기본 설정)\nconst iamporter = new Iamporter();\n\n// For Production\nconst iamporter = new Iamporter({\n  apiKey: 'YOUR_API_KEY',\n  secret: 'YOUR_SECRET'\n});\n```\n\n### API Token\n\n- `iamporter`는 API 요청 전에 API 토큰의 유효성을 확인 후 자동 발급/갱신하므로 직접 토큰 API를 호출할 필요가 없습니다.\n\n```node\n// 인스턴스 생성 시 설정한 API KEY와 SECRET\niamporter.getToken()\n  .then(...)\n\n// 토큰 생성 시 사용될 API KEY와 SECRET 직접 지정\niamporter.getToken('API_KEY', 'SECRET')\n  .then(...)\n```\n\n### Subscription\n\n- 정기 구독(Subscription)형 서비스 등에 이용할 수 있는 빌링키를 관리합니다.\n\n```node\n// 빌링키 생성\niamporter.createSubscription({\n  'customer_uid': 'test_uid',\n  'card_number': '1234-1234-1234-1234',\n  'expiry': '2021-11',\n  'birth': '620201',\n  'pwd_2digit': '99'\n}).then(result =\u003e {\n  console.log(result);\n}).catch(err =\u003e {\n  if (err instanceof IamporterError)\n    // Handle the exception\n});\n\n// 빌링키 조회\niamporter.getSubscription('test_uid')\n  .then(...)\n\n// 빌링키 삭제\niamporter.deleteSubscription('test_uid')\n  .then(...)\n\n// 비인증 결제 (빌링키 이용)\niamporter.paySubscription({\n  'customer_uid': 'test_uid',\n  'merchant_uid': 'test_billing_key',\n  'amount': 50000\n}).then(result =\u003e {\n    console.log(result);\n}).catch(err =\u003e {\n  if (err instanceof IamporterError)\n    // Handle the exception\n});\n```\n\n### Onetime Payment\n\n- 빌링키를 생성하지 않아도 신용카드 정보만으로 간편 결제를 할 수 있습니다.\n\n```node\n// Onetime 비인증 결제\niamporter.payOnetime({\n  'merchant_uid': 'merchant_1448280088556',\n  'amount': 5000,\n  'card_number': '1234-1234-1234-1234',\n  'expiry': '2021-12',\n  'birth': '590912',\n  'pwd_2digit': '11'\n}).then(result =\u003e {\n    console.log(result);\n}).catch(err =\u003e {\n  if (err instanceof IamporterError)\n    // Handle the exception\n});\n\n// 해외카드 비인증 결제\niamporter.payForeign({\n  'merchant_uid': 'merchant_1448280088556',\n  'amount': 5000,\n  'card_number': '1234-1234-1234-1234',\n  'expiry': '2021-12',\n}).then(result =\u003e {\n    console.log(result);\n}).catch(err =\u003e {\n  if (err instanceof IamporterError)\n    // Handle the exception\n});\n```\n\n### Cancel the Payment\n\n- 아임포트 고유 아이디 혹은 상점 고유 아이디로 결제 취소가 가능합니다.\n- 부분 결제 취소 또한 지원됩니다.\n\n```node\n// 아임포트 고유 아이디로 결제 취소\niamporter.cancelByImpUid('imp_448280090638')\n  .then(...)\n\n// 상점 고유 아이디로 결제 취소\niamporter.cancelByMerchantUid('merchant_1448280088556')\n  .then(...)\n\n// 상점 고유 아이디로 부분 결제 취소\niamporter.cancelByMerchantUid('merchant_1448280088556', {\n  'amount': 2500,\n  'reason': '예약 변경'\n}).then(...)\n\n// 결제 취소 후 계좌 환불\niamporter.cancel({\n  'imp_uid': 'imp_448280090638',\n  'reason': '제품 상태 불량',\n  'refund_holder': '홍길동',\n  'refund_bank': '03',\n  'refund_account': '056-076923-01-017'\n).then(...)\n```\n\n### Find the Payments\n\n- 아임포트에서는 아임포트 고유 아이디(ImpUid)와 상점 고유 아이디(MerchantUid)로 결제정보 조회가 가능합니다.\n\n```node\n// 아임포트 고유 아이디로 결제정보 조회\niamporter.findByImpUid('imp_448280090638')\n  .then(...)\n\n// 상점 고유 아이디로 결제정보 조회\niamporter.findByMerchantUid('merchant_1448280088556')\n  .then(...)\n\n// 상점 고유 아이디로 결제정보 목록 조회\niamporter.findAllByMerchantUid('merchant_1448280088556')\n  .then(...)\n\n// 결제 상태로 결제정보 목록 조회(status: ['all', 'ready', 'paid', 'cancelled', 'failed'])\niamporter.findAllByStatus('paid')\n  .then(...)\n```\n\n### Prepared Payment\n\n- 아임포트에서는 결제 건에 대한 사전 정보 등록 및 검증을 할 수 있습니다.\n\n```node\n// 결제 예정금액 사전 등록\niamporter.createPreparedPayment({\n  'merchant_uid': 'merchant_1448280088556',\n  'amount', '128900'\n}).then(...)\n\n// 결제 예정금액 조회\niamporter.getPreparedPayment('merchant_1448280088556')\n  .then(...)\n```\n\n### Certifications\n\n- 아임포트에서는 SMS 본인인증 결과를 조회/삭제할 수 있습니다.\n\n```node\n// 아임포트 고유 아이디로 SMS 본인인증 결과 조회\niamporter.getCertification('imp_448280090638')\n  .then(...)\n\n// 아임포트 고유 아이디로 SMS 본인인증 결과 삭제\niamporter.deleteCertification('imp_448280090638')\n  .then(...)\n```\n\n### VBanks\n\n- 아임포트에서는 PG 결제화면 없이 API 만으로 가상계좌 발급이 가능합니다.\n\n```node\n// 가상계좌 발급\niamporter.createVbank({\n  'merchant_uid': 'merchant_1448280088556',\n  'amount': '128900',\n  'vbank_code': '03',\n  'vbank_due': 1485697047,\n  'vbank_holder': 'PLAT Corp'\n}).then(...)\n```\n\n\n## Links\n\n- [**아임포트**](http://www.iamport.kr/)\n- [**아임포트 API**](https://api.iamport.kr/)\n- [**아임포트 관리자**](https://admin.iamport.kr/)\n- [**아임포트 매뉴얼**](http://www.iamport.kr/manual/)\n\n\n## Contact\n\nIf you have any questions, feel free to join me at [`#posquit0` on Freenode](irc://irc.freenode.net/posquit0) and ask away. Click [here](https://kiwiirc.com/client/irc.freenode.net/posquit0) to connect.\n\n\n## License\n\n- [MIT](https://github.com/posquit0/node-iamporter/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposquit0%2Fnode-iamporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposquit0%2Fnode-iamporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposquit0%2Fnode-iamporter/lists"}