npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iamport-rest-client-nodejs

v0.9.12

Published

NodeJS용 아임포트 REST API Client 입니다.

Downloads

2,011

Readme

iamport-rest-client-nodejs

alt text alt text alt text

NodeJS용 아임포트 REST API Client 입니다.

버전정보

최신 버전은 v0.9.12입니다.

설치하기

아래 명령어를 통해 iamport-rest-client-nodejs를 귀하의 nodeJS 프로젝트에 추가합니다.

$ npm install iamport-rest-client-nodejs

API 호출하기

아래는 iamport-rest-client-nodejs를 활용해 은행 정보 조회 API를 호출하는 예제 코드입니다.

// 1. 아임포트 REST API 호출에 필요한 모듈을 불러옵니다.
import { Iamport, Request, Enum } from 'iamport-rest-client-nodejs';
const { Banks } = Request;
const { BankCodeEnum } = Enum;

// 2. 아임포트 객체를 생성합니다. 귀하의 API 정보는 아임포트 관리자페이지 > 시스템설정 > 내정보를 참고해주세요.
const iamport = new Iamport({
  apiKey: '귀하의_REST_API_KEY를_입력해주세요', 
  apiSecret: '귀하의_REST_API_SECRET_KEY를_입력해주세요',
});

// EX1. 모든 은행 정보를 조회합니다.
const getBanks = Banks.getBanks();
getBanks.request(iamport)
.then(response => console.log('response: ', response.data))
.catch(error => console.log('error: ', error.response.data));

// EX2. 특정 은행 정보를 조회합니다.
const getBank = Banks.getBank({
  code: BankCodeEnum.SC,
});
await getBank.request(iamport)
.then(response => console.log('response: ', response.data))
.catch(error => console.log('error: ', error.response.data));

테스트하기

프로젝트를 클론 받은 후 필요한 모듈을 설치합니다. yan example 명령어를 통해 테스트할 타깃, REST API 키 그리고 REST API SECRET 키를 입력합니다.

$ git clone https://github.com/SoleeChoi/iamport-rest-client-nodejs.git
$ cd ./iamport-rest-client-nodejs
$ npm install
$ yarn example [테스트 타깃] [apiKey] [apiSecret]

테스트 타깃의 종류는 아래와 같습니다.

| 타깃 | 내용 | | -------------- | -------------------------- | | authenticate | 사용자 인증 테스트 | | payments | 일반결제 테스트 | | prepare | 결제 예정 금액 등록 및 조회 테스트 | | escrows | 에스크로 결제 테스트 | | vbanks | 가상계좌 테스트 | | subscribe | 정기결제 테스트 | | customers | 빌링키 테스트 | | payco | 페이코 테스트 | | kakao | 카카오페이 테스트 | | naverco | 네이버페이 주문형 테스트 | | naverpay | 네이버페이 결제형 테스트 | | receipts | 현금영수증 테스트 | | external | 현금결제 영수증 테스트 | | certifications | 휴대폰 본인인증 테스트 | | cards | 금융결제원 카드사 코드 테스트 | | banks | 금융결제원 은행 코드 테스트 | | enum | ENUM 테스트 |

REST API 키REST API SECRET 키는 아임포트 관리자페이지 > 시스템 설정 > 내정보에서 확인하실 수 있습니다. 자세한 정보는 가맹점 정보 확인하기를 참고해주세요. 미입력시 아임포트 테스트용 REST API 키REST API SECRET 키로 테스트가 진행됩니다.

테스트 예시는 아래와 같습니다.

$ npm install
$ yarn example payments imp_apikey ekKoeW8RyKuT0zgaZsUtXXTLQ4AhPFW3ZGseDA6bkA5lamv9OqDMnxyeB9wqOsuO9W3Mx9YSJ4dTqJ3f