npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-seerbit

v0.3.4

Published

SeerBit react native sdk is used to seamlessly integrate SeerBit payment gateways into react native applications. It is very simple and easy to integrate.

Downloads

17

Readme

seerbit

SeerBit React Native Checkout

SeerBit React Native sdk is used to seamlessly integrate SeerBit payment gateways into React Native applications. It is very simple and easy to integrate. It is a wrapper built around SeerBit checkout on native ios and android.

Requirements:

  • The merchant must have an account with SeerBit or create one on SeerBit Merchant Dashboard to get started.
  • Obtain the live public key of the merchant.

Implementation:

  • Add the package to your React native project:
npm install react-native-seerbit

or

yarn add react-native-seerbit
  • Then navigate the ios folder of your project, run
pod install
  • If you encounter an error, be sure that flipper is disabled by commenting out the following line in your podfile
 :flipper_configuration => flipper_config,

and be sure that use_frameworks is enabled by adding the following line in your podfile before target

use_frameworks! :linkage => :static 

If you still encounter an error that states like "Multiple commands produce........./Assets.car", then also add the below code to your podfile, before target.

install! 'cocoapods', :disable_input_output_paths => true

This should fix all problems.

  • After adding the package to your project, import SeerBitCheckout methods into the file you want to use them like so:
import { openCheckout, eventEmitter } from 'react-native-seerbit';

Configure deeplink in your project

  • Add deeplink configuration to ios part of your project with the following custom uri scheme:
seerbitioscheckout
  • The most straightforward way to add a deeplink is to click on the info tab when you select your project target on Xcode. Click on the URL Types chevron and paste "seerbitioscheckout" on URL Schemes placeholder.

  • This sdk works for iOS 16.0 and above. Make sure your project is targeting iOS 16.0 and above. In the case where your project targets ios 15 and below, the sdk will install, but users running ios 15 and below will be prompted to update thier ios version.

  • Note that if you already have a url scheme for your project, you still have to create another one with the custom url scheme above.

Usage: These parameters must be supplied to the openCheckout method;

Required:

  • Merchant's live public key // SBTESTPUBK_t4G16GCA1O51AV0Va3PPretaisXubSw1 (This a test public key for test purpose)
  • Amount
  • Customer's full name
  • Customer's email
  • Customer's phone number

Optional

  • productId // defaults to empty string
  • vendorId //defaults to empty string
  • currency //defaults to merchant's country currency
  • country //defaults to merchant's country
  • pocketReference // used when money is to be moved to pocket
  • transactionPaymentReference //we generate payment reference for each transaction, but if you supply yours, the sdk will use it.
  • tokenize // used only when card is to be tokenized - defaults to false
  • productDescription //defaults to empty string

Example

import * as React from 'react';
import { StyleSheet, View, Text, TouchableOpacity, SafeAreaView } from 'react-native';
import { openCheckout, eventEmitter } from 'react-native-seerbit';

interface Props {
   placeholder: string,
   value: string,
   onChangeText: any,
   style?: object,
   rootStyle?: object,
   isForPassword?: boolean,
   keyboardType?: 'default' | 'numeric',
   editable?: boolean,
   placeholderStyle?: string,
   onEnterPressed?: any,
   returnKeyType?: 'next' | 'done',
   disabled?: boolean,
   onFocus?: () => void,
   onBlur?: () => void,
   toFocus?: boolean
}
const CustomInput: React.FC<Props> = ({
   placeholder,
   placeholderStyle,
   value,
   onChangeText = () => { },
   style,
   rootStyle,
   editable = true,
   keyboardType = 'default',
   onEnterPressed = () => { },
   returnKeyType = 'next',
   onBlur = () => { },
   onFocus = () => { },
}) => {
   const [focus, setFocus] = useState<boolean>(false)
   const inputRef = useRef<any>(null)


   return (
       <View
           style={[focus ? styles.root1 : styles.root2, rootStyle]}
       >
           <TextInput
               placeholder={placeholder}
               value={value}
               onChangeText={onChangeText}
               style={[styles.input, style]}
               onFocus={() => {
                   setFocus(true)
                   onFocus()
               }}
               onBlur={() => {
                   setFocus(false)
                   onBlur()
               }}
               editable={editable}
               placeholderTextColor={placeholderStyle ? placeholderStyle : 'gray'}
               keyboardType={keyboardType}
               returnKeyType={returnKeyType}
               onSubmitEditing={onEnterPressed}
               ref={inputRef}
           />
       </View>
   )
}



export default function App() {

 const [amount, setAmount] = React.useState<string>('20.5')
 const [phoneNumber, setPhoneNumber] = React.useState<string>('08131248253')
 const [publicKey, setPublicKey] = React.useState<string>('SBTESTPUBK_t4G16GCA1O51AV0Va3PPretaisXubSw1')
 const [fullName, setFullName] = React.useState<string>('SeerBit Checkout')
 const [email, setEmail] = React.useState<string>('[email protected]')


 React.useEffect(() => {
   let closeEventListener = eventEmitter.addListener('close', (event) => {
     console.log('user closed', event?.eventProperty);
   });
   let successEventListener = eventEmitter.addListener('success', (event) => {
     console.log('user success ', event?.eventProperty);
   });
   return () => {
     closeEventListener.remove();
     successEventListener.remove();
   };
 }, []);

 const open = () => {
   openCheckout({
     amount: amount,
     phoneNumber: phoneNumber,
     publicKey: publicKey,
     fullName: fullName,
     email: email,
     productDescription: 'productDescription',
     pocketReference: 'pocketReference',
     transactionPaymentReference: '',
     vendorId: 'vendorId',
     country: 'NG',
     currency: 'NGN',
     tokenize: false,
     productId: 'productId',
   });
 };

 return (
   <SafeAreaView>
     <View style={styles.container}>
       <CustomInput
         value={amount}
         onChangeText={(val: string) => setAmount(val)}
         placeholder='Amount'
         rootStyle={{ marginBottom: 15 }}
         keyboardType={'numeric'}
       />
       <CustomInput
         value={phoneNumber}
         onChangeText={(val: string) => setPhoneNumber(val)}
         placeholder='Phone number'
         rootStyle={{ marginBottom: 15 }}
         keyboardType={'numeric'}
       />
       <CustomInput
         value={publicKey}
         onChangeText={(val: string) => setPublicKey(val)}
         placeholder='Public key'
         rootStyle={{ marginBottom: 15 }}
       />
       <CustomInput
         value={fullName}
         onChangeText={(val: string) => setFullName(val)}
         placeholder='Full name'
         rootStyle={{ marginBottom: 15 }}
       />
       <CustomInput
         value={email}
         onChangeText={(val: string) => setEmail(val)}
         placeholder='Email'
         rootStyle={{ marginBottom: 15 }}
       />

       <TouchableOpacity
         onPress={open}
         style={styles.btn}>
         <Text style={{ color: 'white' }}>Open Checkout</Text>
       </TouchableOpacity>
     </View>
   </SafeAreaView>
 );
}

const styles = StyleSheet.create({
 container: {
   flex: 1,
   alignItems: 'center',
   paddingTop: 80
 },
 box: {
   width: 60,
   height: 60,
   marginVertical: 20,
 },
 btn: {
   width: '90%',
   height: 40,
   borderRadius: 5,
   backgroundColor: 'green',
   alignItems: 'center',
   justifyContent: 'center',
   marginTop: 50
 },
 input: {
       width: '80%',
       color: '#1E2234',
   },
   root1: {
       width: '90%',
       height: 50,
       backgroundColor: '#F5F5F5',
       justifyContent: 'space-between',
       paddingHorizontal: 10,
       borderRadius: 8,
       marginRight: 'auto',
       marginLeft: 'auto',
       borderWidth: 1.2,
       borderColor: '#F24736',
       flexDirection: 'row',
       alignItems: 'center'
   },
   root2: {
       width: '90%',
       height: 50,
       backgroundColor: '#F5F5F5',
       justifyContent: 'space-between',
       paddingHorizontal: 10,
       borderRadius: 8,
       marginRight: 'auto',
       marginLeft: 'auto',
       flexDirection: 'row',
       alignItems: 'center'
   }
});

Properties:

| Property | type | required | default | Desc | |-----------------------------|----------|-----------|---------|-----------------------------------------------------------------------------| | currency | String | Optional | NGN | The currency for the transaction e.g NGN | | email | String | Required | None | The email of the user to be charged | | publicKey | String | Required | None | Your Public key or see above step to get yours | | amount | String | Required | None | The transaction amount | | fullName | String | Required | None | The fullname of the user to be charged | | phoneNumber | String | Required | None | User phone Number | | pocketReference | String | Optional | None | This is your pocket reference for vendors with pocket | | vendorId | String | Optional | None | This is the vendorId of your business using pocket | | tokenize | bool | Optional | False | Tokenize card | | country | String | Optional | NG | Transaction country which can be optional | | transactionPaymentReference | String | Optional | None | Set a unique transaction reference for every transaction | | productId | String | Optional | None | This is the productId which is optional | | productDescription | String | Optional | None | The transaction description which is optional |

Support:

If you encounter any problems, or you have questions or suggestions, create an issue on this repo or send your inquiry to [email protected]