Skip to content

gusbueno/react-native-openpay

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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));

About

An Android and iOS Openpay sdk wrapper for React Native.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 81.7%
  • Objective-C 17.7%
  • JavaScript 0.6%