SDK Installation and Setup

The Humance SDK simplifies the integration of philanthropy features into your React Native application. It includes built-in components and API configurations for a seamless setup, enabling developers to focus on delivering a polished user experience.


Requirements


Installation

Since the SDK is hosted in a private repository, you need to configure SSH access before installation. Follow these steps:

  1. Download the Private SSH Key:

    • Contact Humance to receive your private SSH key.

  2. Add the SSH Key to Your ssh-agent:

ssh-add /path/to/your-private-key

Install the SDK: Add the SDK to your project dependencies and install it using the command:

"react-native-humance-sdk": "git+ssh@github.com:humance/react-native-humance-sdk.git"

Install Peer Dependencies: Follow the installation guides for each dependency linked in the requirements section above.


Usage

The Humance SDK provides two primary ways to embed features into your app:

  1. Using the <Humance /> Component The <Humance /> component renders the Projects-Stories module, displaying supported projects, their stories, and new projects.

Pressing on an unsupported project navigates to the project list page.

Example:

import { Humance } from 'react-native-humance-sdk';

<Humance
  apiConfig={{
    userEmail: 'user@example.com',
    apiKey: 'your-api-key',
    apiSecret: 'your-api-secret',
  }}
  paymentPageBalance={2440.98}, // user's balance in USD
  allowPersonalization=true // 
/>;

Props: HumanceConfig

  • apiConfig: Configuration object containing the API keys and email.

  • paymentPageBalance: The balance amount is to be displayed on the payment screen in USD.

  • allowPersonalization: Allow hash for new users, learn more in the User Data Hashing section

  1. Using openHumance(config: HumanceConfig)

openHumance allows you to open the project list page directly. Use it to create an additional button if necessary:

Example:

import { openHumance } from 'react-native-humance-sdk';

openHumance({
  paymentPageBalance: 2440.98, // user's balance in USD
  apiConfig: {
    userEmail: 'user@example.com',
    apiKey: 'your-api-key',
    apiSecret: 'your-api-secret',
  },
});

Example of the button:


Configuration Structure

HumanceConfig

APIConfig

Last updated