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

capacitor-tosspayments

v1.0.3

Published

Capacitor plugin for toss payments

Downloads

5

Readme

capacitor-tosspayments

alt text

토스페이먼츠를 Ionic / Capacitor 환경에서 사용할 수 있도록 만든 플러그인입니다

지원정보

  • 현재 이 플러그인은 Capacitor v2만 지원합니다.
  • 현재 이 플러그인은 토스페이먼츠의 일반결제 내 requestPayment() 기능만 제공합니다.

설치하기

아래 명령어를 통해 Capacitor 모듈을 귀하의 캐패시터 프로젝트에 추가할 수 있습니다.

$ npm install capacitor-tosspayments --save

앱을 빌드하고 빌드한 내용을 네이티브 코드에 카피합니다.

$ npm run build 또는 ionic build
$ npx cap copy

설정하기

카드사 앱(서드파티앱)을 열기 위한 설정이 필요합니다. 아임포트 캐퍼시터 플러그인과 동일한 방식으로 돌아가므로 해당 설정을 참고해주세요.

안드로이드 설정하기

1. Plugin 모듈 추가하기

import glit.capacitor.tosspayments.TossPaymentsPlugin;

public class MainActivity extends BridgeActivity {
    ...
    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
        ...
        add(TossPaymentsPlugin.class);
    });
}

2. Webview를 위한 액티비티 추가하기

AndroidManifest.xml 파일(android/app/src/main에 위치)에 액티비티를 아래와 같이 추가해주세요.

<manifest>
  <application>
    ...
    <activity
      android:name="glit.capacitor.tosspayments.TossPaymentsActivity"
      android:label="TossPaymentsActivity"
    >
    </activity>
    ...
  </application>
</manifest>

iOS 설정하기

1. 외부 앱 URL 스킴 등록 info.plist

...
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>itms-appss</string>
  <string>supertoss</string>
  <string>kb-acp</string>
  <string>liivbank</string>
  <string>nhappcardansimclick</string>
  <string>nhallonepayansimclick</string>
  <string>nonghyupcardansimclick</string>
  <string>lottesmartpay</string>
  <string>lotteappcard</string>
  <string>mpocket.online.ansimclick</string>
  <string>ansimclickscard</string>
  <string>tswansimclick</string>
  <string>ansimclickipcollect</string>
  <string>vguardstart</string>
  <string>samsungpay</string>
  <string>scardcertiapp</string>
  <string>shinhan-sr-ansimclick</string>
  <string>smshinhanansimclick</string>
  <string>com.wooricard.wcard</string>
  <string>newsmartpib</string>
  <string>citispay</string>
  <string>citicardappkr</string>
  <string>citimobileapp</string>
  <string>cloudpay</string>
  <string>hanawalletmembers</string>
  <string>hdcardappcardansimclick</string>
  <string>smhyundaiansimclick</string>
  <string>shinsegaeeasypayment</string>
  <string>payco</string>
  <string>lpayapp</string>
  <string>ispmobile</string>
  <string>tauthlink</string>
  <string>ktauthexternalcall</string>
  <string>upluscorporation</string>
</array>

2. App Transport Security 설정 info.plist

...
<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoadsInWebContent</key>
  <true/>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

참고

https://github.com/iamport/iamport-capacitor/blob/master/manuals/SETTING_IOS.md https://github.com/iamport/iamport-capacitor/blob/master/manuals/SETTING_ANDROID.md

API

import { TossPayments } from 'capacitor-tosspayments';
...
const clientKey = 'test_ck_D5GePWvyJnrK0W0k6q8gLzN97Eoq';
const tossPayments = new TossPayments(clientKey);

await tossPayments.requestPayment('카드', {
      amount: 15000,
      orderId: 'WyzNriVXGrKJOZHx-g2ks',
      orderName: '토스 티셔츠 외 2건',
      customerName: '박토스',
      successCallback: (url:string)=>{
        console.log('결제 성공: ' + decodeURIComponent(url));
      },
      failCallback: (url:string)=>{
        console.log('결제 실패: ' + decodeURIComponent(url));
      },
    });

주의사항

  • iOS / Android 환경에서 플러그인 웹뷰와 Ionic 웹뷰간의 소통을 위해, 토스페이먼츠 SDK의 successUrlfailUrl 파라미터가 successCallbackfailCallback 형태의 콜백함수(필수)로 대체됩니다.
  • Web 환경(Unimplemented)에서는, 토스페이먼츠 JS SDK와 동일하게, successUrlfailUrl 파라미터로 작동되며, successCallbackfailCallback은 무시됩니다.