
Security News
Node.js Considers Public Workflow for Security Reports Amid AI-Driven Surge
Node.js is debating whether AI-driven security report volume warrants moving more vulnerability reports into public workflows.
iamport-server-api
Advanced tools
npm install --save iamport-server-api
iamport-server-api 는 fake-iamport-server 를 기반으로 만들어진 SDK (Software Development Kit) 이다. 그리고 fake-iamport-server 는 아임포트의 API 명세사항을 따라 만든 목업 서버이기에, 본 iamport-server-api 는 진짜 아임포트 서버와의 연동에도 사용할 수 있다.
고로 아임포트와 연동하는 TypeScript 기반 백엔드 서버를 개발함에 있어, 가짜 아임포트 서버 fake-iamport-server 는 직접 이용치 않더라도, 실제 아임포트 서버와의 연동을 위하여, 본 SDK 라이브러리만큼은 반드시 설치하기를 권장하는 바이다.
import { v4 } from "uuid";
import imp from "iamport-server-api";
import { IIamportCardPayment } from "iamport-server-api/lib/structures/IIamportCardPayment";
import { IIamportPayment } from "iamport-server-api/lib/structures/IIamportPayment";
import { IIamportResponse } from "iamport-server-api/lib/structures/IIamportResponse";
export async function test_fake_card_payment(): Promise<IIamportCardPayment>
{
// 커넥터 정보 구성, 토큰 만료시 자동으로 갱신해 줌
const connector: imp.IamportConnector = new imp.IamportConnector
(
"http://127.0.0.1:10851",
{
imp_key: "test_imp_key",
imp_secret: "test_imp_secret"
}
);
// 카드로 결제하기
const output: IIamportResponse<IIamportCardPayment> =
await imp.functional.subscribe.payments.onetime
(
await connector.get(),
{
card_number: "1111-2222-3333-4444",
expiry: "2028-12",
birth: "880311",
merchant_uid: v4(),
amount: 25_000,
name: "Fake 주문"
}
);
// 결제 내역 조회하기
const reloaded: IIamportResponse<IIamportPayment> =
await imp.functional.payments.at
(
await connector.get(),
output.response.imp_uid,
{},
);
// 결제 방식 및 완료 여부 확인
const payment: IIamportPayment = reloaded.response;
if (payment.pay_method !== "card")
throw new Error("Bug on payments.at(): its pay_method must be card.");
else if (!payment.paid_at || payment.status !== "paid")
throw new Error("Bug on payments.at(): its status must be paid.");
// 첫 번째 if condition 에 의해 자동 다운 캐스팅 된 상태
payment.card_number;
return payment;
}
FAQs
API for Iamport Server
The npm package iamport-server-api receives a total of 49 weekly downloads. As such, iamport-server-api popularity was classified as not popular.
We found that iamport-server-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js is debating whether AI-driven security report volume warrants moving more vulnerability reports into public workflows.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.