SERVICE React Native Library

This page will help you get started with SERVICES.

Create npmrc File

Create .npmrc file in React Native project root folder with the following information:

@card91:registry=https://registry.npmjs.org
//registry.npmjs.org/:_authToken=ghp_Access_Token

This files direct npm client to look for all packages starting from @github-banc91 in the registry - https://registry.npmjs.org/

As it is a private repository, it would need a private token to access it (ghp_Access_Token)
Please reach out to Card91 team to get this token

Installation

Install the package using npm using the following command:

npm install --save-exact @card91/react-native-sdk

or using yarn:

yarn add --exact @card91/react-native-sdk

📘

Peer Dependencies

Our React Native SDK relies on the react-native-webview library, so please make sure that it is installed before using the SDK.

Usage

Use the method to integrate place you want to use:

Method NameDescription
loginWithAuthTokenuse this method to login customer
getCardFlagsallows you to gets card flags for a card
updateCardFlagsability to Sets card flags for a card
lockCarduse this method to Locks a card
getCardWalletDetailsallows you to gets Wallet details for a card
blockCardOTPuse this method to Initiates a Card block request
blockCardConfirmationallow you to Blocks a card on OTP Confirmation
addBeneficiaryallows you to add a beneficiary to transfer funds.
getAllBeneficiaryUse this method to get the details of a All beneficiary in your account
getBeneficiaryDetailsUse this method to get the details of a particular beneficiary in your account
transferMoneyToBeneficiaryallows you Transfer money to your beneficiaries accounts
updateBeneficiaryLimitability to update the Beneficiary limit
updateBeneficiaryLimitVerifyallow you to update the Beneficiary limit on OTP Confirmation
getBeneficiaryTransactionsUse this method to get the all transaction of a particular beneficiary
getCardLimitUse this method to fetch individual card limt details
setCardLimitUse this method to Set/Update individual card limt details
import * as React from 'react';

import { Button, StyleSheet, View } from 'react-native';
import {
  loginWithAuthToken,
  getCardFlags,
  updateCardFlags,
  lockCard,
  getCardWalletDetails,
  blockCardOTP,
  blockCardConfirmation,
  addBeneficiary,
  getAllBeneficiary,
  getBeneficiaryDetails,
  transferMoneyToBeneficiary,
  updateBeneficiaryLimit,
  updateBeneficiaryLimitVerify,
  getBeneficiaryTransactions,
  getCardLimit,
  setCardLimit,
} from '@card91/react-native-sdk';

export default function App() {
  const [token, setToken] = React.useState('');
  const [cardId, setCardId] = React.useState('');

  const login = async () => {
    try {
      const response = await loginWithAuthToken(
        {
          mobile: '[MOBILE_NO]', // Registed Mobile Numner of customer
          sdkAuthToken: '[SDK_AUTH_TOKEN]',// SDK AUth Token
          primaryOrgId: '[ORG_ID]', // Organization Id
        },
        'sandbox' // use Environment 'sandbox' or 'live'
      );
      console.log('response', response);
      if (response.success) {
        const { headers, data } = response;
        setToken(headers.map.login_token);
        setCardId(data.cards[0].id);
      }
    } catch (error) {
      console.error(error);
    }
  };

  const getFlags = async () => {
    const respFlags = await getCardFlags(
      {
        cardId: cardId,// fetch from loginWithAuthToken
        loginAuthToken: token,// fetch from loginWithAuthToken
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('response', respFlags);
  };

  const updateCardFlags = async () => {
    const response = await updateCardFlags(
      {
        cardId: cardId,
        cardFlags: {
          ATM_ENABLED: true,
          POS_ENABLED: true,
          ECOM_ENABLED: true,
          CL_ENABLED: true,
        },
        loginAuthToken: token,
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('response', response);
  };
  const lockCard = async () => {
    const respFlags = await lockCard(
      {
       cardId: cardId,// fetch from loginWithAuthToken
        loginAuthToken: token,// fetch from loginWithAuthToken
        lock: true,
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('response', respFlags);
  };

  const getCardWalletDetails = async () => {
    const respFlags = await getCardWalletDetails(
      {
        cardId: cardId,// fetch from loginWithAuthToken
        loginAuthToken: token,// fetch from loginWithAuthToken
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('respFlags', respFlags);
  };
  const blockCardOTP= async () => {
    const respFlags = await blockCardOTP(
      {
       cardId: cardId,// fetch from loginWithAuthToken
        loginAuthToken: token,// fetch from loginWithAuthToken
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('respFlags', respFlags);
  };
  const blockCardConfirmation = async () => {
    const respFlags = await blockCardConfirmation(
      {
       cardId: cardId,// fetch from loginWithAuthToken
        loginAuthToken: token,// fetch from loginWithAuthToken
        reason: ['REASON_FOR_BLOCK_CARD'],
      	sessionId:['SESSION_ID_FROM_BLOCK_CARD_OTP'],
      	otp: ['OTP'],
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('respFlags', respFlags);
  };

  const addBeneficiaryFunc = async () => {
    const respFlags = await addBeneficiary(
      {
        loginAuthToken: token,// fetch from loginWithAuthToken
        mobileNo: [CUSTOMER_MOBILE_NUMBER],
        issuerCode: [BENEFICIARY_ISSUER_CODE],
        accountNumber: [BENEFICIARY_ACCOUNT_NUMBER],
        ifscCode: [BENEFICIARY_IFSC_CODE],
        name: [BENEFICIARY_NAME],
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('respFlags', respFlags);
  };

  const getAllBeneficiaryFUNC = async () => {
    const response = await getAllBeneficiary(
      {
        loginAuthToken: token,// fetch from loginWithAuthToken
        mobileNo: [CUSTOMER_MOBILE_NUMBER],
        issuerCode: [BENEFICIARY_ISSUER_CODE],
        ifscCode: [BENEFICIARY_IFSC_CODE],
        name: [BENEFICIARY_NAME],
    		page:[PAGE_NUMBER],
        perPage:[PAGE_PAGE_COUNT]
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('response', response);
  };

 const getBeneficiaryDetailsFunc = async () => {
    const response = await getBeneficiaryDetails(
      {
        loginAuthToken: token,// fetch from loginWithAuthToken
        beneficiaryId: [BENEFICIARY_ID],
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('response', response);
  };

   const transferMoneyToBeneficiaryFUNC = async () => {
    const response = await transferMoneyToBeneficiary(
      {
        cardId: cardId,// fetch from loginWithAuthToken
        loginAuthToken: token,// fetch from loginWithAuthToken
        beneficiaryId: [BENEFICIARY_ID],
        amount: [AMOUNT],
  			transferMethod: [TRASFER_METHOD], //IMPS
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('response', response);
  };

  const updateBeneficiaryLimitFunc = async () => {
    const response = await updateBeneficiaryLimit(
      {
        loginAuthToken: token,// fetch from loginWithAuthToken
        beneficiaryId: [BENEFICIARY_ID],
        maxMonthlyLimit: [MAX_MONTHLY_LIMIT],
        dailyRequestLimit: [DAILY_REQUEST_LIMIT],
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('response', response);
  };

  const updateBeneficiaryLimitVerifyFUNC = async () => {
    const response = await updateBeneficiaryLimitVerify(
      {
        loginAuthToken: token,// fetch from loginWithAuthToken
        beneficiaryId: [BENEFICIARY_ID],
        maxMonthlyLimit: [MAX_MONTHLY_LIMIT],
        dailyRequestLimit: [DAILY_REQUEST_LIMIT],
        otp:[OTP],// it will send to customer mobile number
        sessionId:[SESSION_ID] // IN updateBeneficiaryLimit response will get sessionId
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('response', response);
  };

  const getBeneficiaryTransactionsFunc = async () => {
    const response = await getBeneficiaryTransactions(
      {
        loginAuthToken: token,// fetch from loginWithAuthToken
        beneficiaryId: [BENEFICIARY_ID],
        transferStatus: [STATUS],
        txnMethod: [TXN_METHOD],
        page:[PAGE_NUMBER],
        perPage:[PAGE_PAGE_COUNT]
        from: [FROM_DATE],
        to: [TO_DATE],
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('response', response);
  };

  const getCardLimitFunc = async () => {
    const response = await getCardLimit(
      {
        loginAuthToken: token,// fetch from loginWithAuthToken
        cardId: cardId,// fetch from loginWithAuthToken
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('response', response);
  };

   const setCardLimitFunc = async () => {
    const response = await setCardLimit(
      {
        loginAuthToken: token,// fetch from loginWithAuthToken
        cardId: cardId,// fetch from loginWithAuthToken
        cardLimit:  //  need  to get array of object in  getCardLimit responnse adn modified it pass here
        [
          {
                "txnType": "ECOM",
                "userLimit": "200",
                "maxLimit": "10000",
                "period": "M",
                "enabled": false
            },
            {
                "txnType": "ECOM",
                "userLimit": "10000",
                "maxLimit": "10000",
                "period": "D",
                "enabled": false
            },
            {
                "txnType": "ECOM",
                "userLimit": "10",
                "maxLimit": "10000",
                "enabled": false
            },
            {
                "txnType": "CL",
                "userLimit": "10000",
                "maxLimit": "10000",
                "period": "D",
                "enabled": false
            },
            {
                "txnType": "CL",
                "userLimit": "5000",
                "maxLimit": "5000",
                "enabled": false
            }
        ]
      },
      'sandbox'// use Environment 'sandbox' or 'live'
    );
    console.log('response', response);
  };

  return (
    <View style={styles.container}>
      {!token && <Button title="login" onPress={login} />}
      {token && (
        <>
          <Button title="get Card Flags" onPress={getFlags} />
          <Button title="update Card Flags" onPress={updateCardFlags} />
          <Button title="lockCard" onPress={lockCard} />
          <Button title="Wallet Details" onPress={getCardWalletDetails} />
           <Button title="Add Beneficiary Func" onPress={addBeneficiaryFunc} />
        </>
      )}
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  box: {
    width: 60,
    height: 60,
    marginVertical: 20,
  },
});


Responses

NameTypeDescription
successbooleanit should come in true/false based on value
dataobjectit will have response data from card91 services
headerobjectit will have response header from card91 services