Code Monkey home page Code Monkey logo

react-native-payjp's Introduction

MIT License

react-native-payjp

PAY.JPcardtoken を React Native アプリで使うためのコンポーネントです。

インストール方法

npm install --save react-native-payjp

パッケージをインストール後、次のコマンドを実行してください。

react-native link react-native-payjp

以上でAndroid向けのインストールは完了です。

iOSの場合は、続いてXcodeでReactNativeのプロジェクトファイルを開いて プロジェクトに空のswiftファイルとbridging-headerを追加してください。 これはSwiftで書かれているPAYJPのライブラリを実行するために Swift標準ライブラリをアプリに組み込むためです。

使用例

import Payjp from 'react-native-payjp';

class App extends Component {
    render() {
        //パブリックキーをセット
        Payjp.setPublicKey("pk_test_c62fade9d045b54cd76d7036");
        //トークンを作成
        Payjp.createToken(
            "4242424242424242", //カード番号
            "123",              //CVC
            "12",               //月
            "2020",             //年
            "TARO YAMADA")      //名前
            .then((res)=>{
                console.log("token:", res); //resに"error"かトークンの文字列が返ります。
            });
            ...
        return (
            ...
        )

ライセンス

MIT

作者

Sunao

react-native-payjp's People

Contributors

sunaokumura avatar itome avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.