Git Product home page Git Product logo

react-native-openpay's Introduction

react-native-openpay

An Android and iOS Openpay sdk wrapper for React Native.

Right now it only suports creating card tokens and getting the device session id as i have no need to
create a card, any PR is welcomed and also critiques, i am mostly a JS programmer, and i know too little of Java and
Obj-c, just enough to ge to this point :), if you know a better way to do something, please, open an issue or PR, lets
have fun :).

Installing

requires version >= 0.47 of react-native

npm install -S react-native-openpay

then link the library to Android/iOS native projects (i havent tested rnpm for this proyect yet):

react-native link react-native-openpay

Usage

before doing anything, setup your instance with your credentials:

import openpay from 'react-native-openpay';

openpay.setup('MERCHANT_ID', 'API_KEY');

// you can pas an extra third parameter to tell the sdk that the app is in production
openpay.setup('MERCHANT_ID', 'API_KEY', true);

create a card token, this function takes an object with the card info and returns a promise, the result is the token
id string (it does not yet support sending an address):

openpay.createCardToken({
    holder_name: 'John Doe',
    card_number: '4111111111111111',
    expiration_month: '02',
    expiration_year: '20',
    cvv2: '110'
  })
  .then(token => console.log(token));

get the device session id, returns a promise, the result is the session id string:

openpay.getDeviceSessionId().then(sessionId => console.log(sessionId));

react-native-openpay's People

Contributors

cesarlanderos avatar

Stargazers

 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.