0.1.1 • Published 2 years ago

react-native-okra-webview v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React-Native-Okra-Webview

Official Okra SDK for React Native/Expo applications. Don't forget to star ✨

About Okra

Okra’s API empowers companies and developers to build products with seamless access to inclusive financial data and secure payments.

alt text

React Native SDK for implementing the OkraJS widget - OkraJS is a safe and secure web drop-in module and this library provides a front-end web (also available in iOS and Android) SDK for account authentication and payment initiation for each bank that Okra supports.

Try the demo

Checkout the widget flow to view how the Okra Widget works. Click "See How it Works"

Before getting started

  • Checkout our get started guide to create your developer account and retrieve your Client Token, API Keys, and Private Keys.
  • Create a sandbox customer, so you can get connecting immediately.

buildWithShortURL

  • If you are using the buildWithShortURL version, you will first need to create a link on your dashboard, and use the short url returend at the end of the creation flow.

Bonus Points

Installing

Using npm:

$ npm install react-native-okra-webview

Using yarn:

$ yarn add react-native-okra-webview

you'll also need to install react-native-webview, to install run ;

$ yarn add react-native-webview

Usuage

For React Native based application import it and use

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * Generated with the TypeScript template
 * https://github.com/react-native-community/react-native-template-typescript
 *
 * @format
 */

import React from 'react';
import {
  Alert,
  SafeAreaView,
  StatusBar,
  useColorScheme,
  View,
} from 'react-native';

import { Okra } from 'react-native-okra-webview';

const App = () => {
  const isDarkMode = useColorScheme() === 'dark';

  return (
    <SafeAreaView style={{flex:1}}>
      <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
      <View  style={{flex:1}}>

        <Okra.BuildWithShortUrl
          short_url={'your-shourt-url'}
          onSuccess={(response: any) => {
            Alert.alert('Success!', JSON.stringify(response))
          }}
          onClose={(response: any) => {
            Alert.alert('error!', JSON.stringify(response))
          }}
        />

      </View>
    </SafeAreaView>
  );
};

export default App;

For others, just use

 /**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * Generated with the TypeScript template
 * https://github.com/react-native-community/react-native-template-typescript
 *
 * @format
 */

 import React, { useState } from 'react';
 import {
   Alert,
   SafeAreaView,
   StatusBar,
   useColorScheme,
   View,
 } from 'react-native';

import { Okra } from 'react-native-okra-webview';

 const App = () => {
   const isDarkMode = useColorScheme() === 'dark';

   return (
     <SafeAreaView style={{flex:1}}>
       <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
       <View style={[style().container, style().flex]}>
         <Okra.BuildWithOptions
           env="<your-env-value>"
           name="<your-name-value>"
           token="<your-token-value>"
           okraKey="<your-key-value>"
           products={['auth', 'identity', 'balance', 'transactions' ]}
           onSuccess={(response: any) => {
             Alert.alert('Success!', JSON.stringify(response))
           }}
           onClose={(response: any) => {
             Alert.alert('error!', JSON.stringify(response))
           }}
         />
       </View>
     </SafeAreaView>
   );
 };

 export default App;

Okra.buildWithOptions Options

NameTypeRequiredDefault ValueDescription
app_idStringtrueYour app id from your Okra Dashboard.
okraKeyStringtrueYour public key from your Okra Dashboard.
tokenStringtrueYour token from your Okra Dashboard.
envStringfalseproductionproduction(live)/production-sandbox (test)
productsArraytrue['Auth']The Okra products you want to use with the widget.
paymentBooelanfalseWhether you want to initiate a payment (https://docs.okra.ng/docs/payments)
chargeObjectfalsePayment charge opject (https://docs.okra.ng/docs/creating-a-charge)
productsArraytrue['Auth']The Okra products you want to use with the widget.
logoString(URL)falseOkra's Logo
nameStringfalseYour Company's nameName on the widget
colorHEXfalse#3AB795Theme on the widget
limitNumberfalse24Statement length
filterObjectfalseFilter for widget
isCorporateBoolenfalsefalseCorporate or Individual account
connectMessageStringfalseInstruction to connnect account
widget_successStringfalseWidget Success Message
widget_failedStringfalseWidget Failed Message
callback_urlString(Url)false
currencyStringfalseNGNWallet to bill
expDatefalseWon't expireExpirary date of widget
optionsObjectfalseYou can pass a object custom values eg id
onSuccessFunctionfalseAction to perform after widget is successful
onCloseFunctionfalseAction to perform if widget is closed
onErrorFunctionfalseAction to perform on widget Error
BeforeCloseFunctionfalseAction to perform before widget close
onEventFunctionfalseAction to perform on widget event

View a complete list of customizable options here

Okra.buildWithShortUrl Options

NameTypeRequiredDescription
short_urlStringtrueYour generated url from our App builder.
onSuccessFunctionfalseAction to perform after widget is successful
onCloseFunctionfalseAction to perform if widget is closed
onErrorFunctionfalseAction to perform on widget Error
BeforeCloseFunctionfalseAction to perform before widget close
onEventFunctionfalseAction to perform on widget event

Done connecting?

Checkout our API Overiview and see how to use the data you've received and other products you can use to create more personalized experiences for your customers!

Not a developer?

Get started without writing a single line of code, Try our App Builder! Click here to get started

Huge Thanks & Credits

(Bob)https://github.com/callstack/react-native-builder-bob

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.1.9

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

4.0.3

2 years ago