2.1.1 • Published 3 months ago

okra-js v2.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Okra Widget JavaScript SDK

alt text

JS library 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 okra-js

Using yarn:

$ yarn add okra-js

Using CDN:

<script src="https://cdn.okra.ng/v2/bundle.js"></script>

Usuage

For JS frameworks import it and use

import Okra from 'okra-js'

For others, just use

Okra.buildWithOptions({
    name: 'Peter the Builder',
    env: 'production-sandbox',
    app_id: '',// app_id from your App builder
    key: '', // Your key from the Okra dashboard
    token: '', // Your token from the okra dashboard
    products: ['auth','identity','balance','transactions', 'income'], //in lowercase
    onSuccess: function(data){
        console.log('options success', data)
    },
    onClose: function(){
        console.log('options close')
    }
})

// OR

Okra.buildWithShortUrl({
    short_url: '', //Your short url from the App builder (https://dash.okra.ng/links)
    onSuccess: function(data){
        console.log('options success', data)
    },
    onClose: function(){
        console.log('options close')
    }
})

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/widget-properties#set-up-payments)
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

Other information

For enquires and questions, contact

  • support@okra.ng
2.1.1

3 months ago

2.1.0

7 months ago

2.0.5

11 months ago

2.0.7

11 months ago

2.0.6

11 months ago

2.0.9

10 months ago

2.0.8

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago