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 🙏

© 2026 – Pkg Stats / Ryan Hefner

payapp-core

v1.0.1

Published

PayApp payment integration core library (framework-agnostic)

Readme

payapp-core

PayApp 결제 연동 Core 라이브러리 (Framework-agnostic)

특징

  • Framework-agnostic: React, Vue, Angular, Vanilla JS 등 모든 프레임워크에서 사용 가능
  • TypeScript: 완전한 타입 지원
  • REST API & JavaScript SDK: 두 가지 방식 모두 지원
  • Webhook 처리: Supabase Edge Function 등에서 사용 가능한 Webhook 핸들러 제공

설치

npm install payapp-core

사용 방법

1. REST API 방식

import { createPayAppClient } from 'payapp-core';

const client = createPayAppClient({
  userid: 'your_userid',
  linkkey: 'your_linkkey',
  linkval: 'your_linkval',
});

// 결제 요청
const response = await client.requestPayment({
  shopname: '상점명',
  goodname: '상품명',
  price: 10000,
  recvphone: '01012341234',
});

console.log(response.payurl); // 결제 페이지 URL

2. JavaScript SDK 방식

import {
  loadPayAppSDK,
  initPayAppSDK,
  requestPaymentWithSDK
} from 'payapp-core';

// SDK 로드
await loadPayAppSDK();

// SDK 초기화
initPayAppSDK('your_userid', '상점명');

// 결제 요청
requestPaymentWithSDK({
  goodname: '상품명',
  price: 10000,
  recvphone: '01012341234',
});

3. Webhook 처리

import { createWebhookHandler } from 'payapp-core/webhook';

const handler = createWebhookHandler(
  {
    userid: 'your_userid',
    linkkey: 'your_linkkey',
    linkval: 'your_linkval',
  },
  {
    onPaymentCompleted: async (feedback) => {
      console.log('결제 완료:', feedback.mul_no);
      // 결제 완료 처리 로직
    },
    onPaymentCancelled: async (feedback) => {
      console.log('결제 취소:', feedback.mul_no);
      // 결제 취소 처리 로직
    },
  }
);

// Supabase Edge Function에서 사용
Deno.serve(handler);

API

PayAppClient

  • requestPayment() - 결제 요청
  • cancelPayment() - 결제 취소
  • registerBill() - 등록결제 등록
  • deleteBill() - 등록결제 삭제
  • payWithBill() - 등록결제로 결제
  • registerRecurringPayment() - 정기결제 요청
  • cancelRecurringPayment() - 정기결제 해지
  • stopRecurringPayment() - 정기결제 일시정지
  • startRecurringPayment() - 정기결제 재개
  • issueCashReceipt() - 현금영수증 발행
  • cancelCashReceipt() - 현금영수증 취소

Webhook Processor

  • PayAppWebhookProcessor - Webhook 처리 클래스
  • createWebhookHandler() - Supabase Edge Function용 핸들러 생성
  • validateFeedback() - Webhook 검증
  • isPaymentCompleted() - 결제 완료 상태 확인
  • isPaymentCancelled() - 결제 취소 상태 확인

Framework 별 사용 예시

Vanilla JavaScript

import { createPayAppClient } from 'payapp-core';

const client = createPayAppClient({
  userid: 'your_userid',
  linkkey: 'your_linkkey',
  linkval: 'your_linkval',
});

document.getElementById('payBtn').addEventListener('click', async () => {
  const response = await client.requestPayment({
    shopname: '상점명',
    goodname: '상품명',
    price: 10000,
    recvphone: '01012341234',
  });
  
  window.location.href = response.payurl;
});

Vue 3

<script setup>
import { createPayAppClient } from 'payapp-core';

const client = createPayAppClient({
  userid: import.meta.env.VITE_PAYAPP_USER_ID,
  linkkey: import.meta.env.VITE_PAYAPP_LINK_KEY,
  linkval: import.meta.env.VITE_PAYAPP_LINK_VAL,
});

const handlePayment = async () => {
  const response = await client.requestPayment({
    shopname: '상점명',
    goodname: '상품명',
    price: 10000,
    recvphone: '01012341234',
  });
  
  window.location.href = response.payurl;
};
</script>

<template>
  <button @click="handlePayment">결제하기</button>
</template>

Angular

import { Component } from '@angular/core';
import { createPayAppClient } from 'payapp-core';

@Component({
  selector: 'app-payment',
  template: '<button (click)="handlePayment()">결제하기</button>'
})
export class PaymentComponent {
  private client = createPayAppClient({
    userid: environment.payappUserId,
    linkkey: environment.payappLinkKey,
    linkval: environment.payappLinkVal,
  });

  async handlePayment() {
    const response = await this.client.requestPayment({
      shopname: '상점명',
      goodname: '상품명',
      price: 10000,
      recvphone: '01012341234',
    });
    
    window.location.href = response.payurl!;
  }
}

React

React를 사용하는 경우 payapp-react 패키지를 사용하는 것을 권장합니다:

npm install payapp-react
import { usePayApp } from 'payapp-react';

function PaymentButton() {
  const { requestPayment, isLoading } = usePayApp({
    credentials: {
      userid: process.env.REACT_APP_PAYAPP_USER_ID,
      linkkey: process.env.REACT_APP_PAYAPP_LINK_KEY,
      linkval: process.env.REACT_APP_PAYAPP_LINK_VAL,
    }
  });

  return (
    <button onClick={() => requestPayment({
      goodname: '상품명',
      price: 10000,
      recvphone: '01012341234',
    })}>
      {isLoading ? '처리 중...' : '결제하기'}
    </button>
  );
}

라이선스

MIT

링크