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 🙏

© 2025 – Pkg Stats / Ryan Hefner

dema-react-native-sdk

v1.0.2

Published

React Native Deema Package

Readme

Deema SDK for BNPL Payment Service (React Native)

Introduction

The Deema SDK for React Native enables seamless integration with our Buy Now, Pay Later (BNPL) payment service. It provides a streamlined API for developers to launch payment flows, handle statuses, and manage transactions effectively.


Prerequisites

  • Minimum Requirements:
    • React Native 0.64 or higher.
    • iOS 11.0+ or Android API Level 21+.

Installation

To include the Deema SDK in your React Native project:

  1. Install the SDK using npm or yarn:
npm install dema-react-native-sdk
# or
yarn add dema-react-native-sdk
  1. Install the dependencies for native platforms:
npx pod-install

Quick Start

Step 1: Import the SDK

Import the DeemaSDK component into your React Native app:

import DeemaSDK from 'dema-react-native-sdk';

Step 2: Initialize the SDK

Use the DeemaSDK component to configure the payment flow with your sdkKey, environment, currency, purchase amount, and merchant order ID.

import React from 'react';
import { View, Alert } from 'react-native';
import DeemaSDK from 'dema-react-native-sdk';

const App = () => {
  const handlePaymentStatus = (status, message) => {
    switch (status) {
      case 'success':
        Alert.alert('Payment Successful', message);
        break;
      case 'failure':
        Alert.alert('Payment Failed', message);
        break;
      default:
        Alert.alert('Payment Status', message);
        break;
    }
  };

  return (
    <DeemaSDK
      sdkKey="your-sdk-key"
      merchantOrderId="order123"
      amount={50.0}
      currencyCode="KWD"
      environment="sandbox" // or "production"
      onPaymentStatus={handlePaymentStatus}
    />
  );
};

export default App;

Example Integration

Basic Integration

Here is a basic example to integrate the Deema SDK into a React Native application:

import React, { useState } from 'react';
import { View, Text, Button, Alert } from 'react-native';
import DeemaSDK from 'dema-react-native-sdk';

const PaymentScreen = () => {
  const [showSDK, setShowSDK] = useState(false);

  const handlePaymentStatus = (status, message) => {
    switch (status) {
      case 'success':
        Alert.alert('Payment Successful', message);
        break;
      case 'failure':
        Alert.alert('Payment Failed', message);
        break;
      default:
        Alert.alert('Payment Status', message);
        break;
    }
    setShowSDK(false);
  };

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      {showSDK ? (
        <DeemaSDK
          sdkKey="your-sdk-key"
          merchantOrderId="order123"
          amount={100.0}
          currencyCode="KWD"
          environment="sandbox"
          onPaymentStatus={handlePaymentStatus}
        />
      ) : (
        <Button title="Start Payment" onPress={() => setShowSDK(true)} />
      )}
    </View>
  );
};

export default PaymentScreen;

API Reference

Props

| Prop Name | Type | Required | Description | |-------------------|------------|----------|--------------------------------------------------------------------------| | sdkKey | string | Yes | Your SDK API key. | | merchantOrderId | string | Yes | Unique identifier for the merchant order. | | amount | number | Yes | The total purchase amount. | | currencyCode | string | Yes | The currency code (e.g., KWD, BHD). | | environment | string | Yes | Specifies the SDK environment (sandbox or production). | | onPaymentStatus | function | Yes | Callback function to handle payment statuses (success, failure). |

Payment Statuses

The onPaymentStatus callback provides the following statuses:

  • success: Payment completed successfully.
  • failure: Payment failed with an optional message.
  • unknown: An unexpected status occurred.

Example onPaymentStatus Callback

const handlePaymentStatus = (status, message) => {
  if (status === 'success') {
    console.log('Payment Successful:', message);
  } else if (status === 'failure') {
    console.error('Payment Failed:', message);
  } else {
    console.warn('Unknown Payment Status:', message);
  }
};

Troubleshooting

Common Issues

  1. No order found:

    • Ensure that sdkKey, merchantOrderId, amount, and currencyCode are correctly configured.
  2. Callback not triggered:

    • Verify that the onPaymentStatus function is properly defined and passed as a prop.
  3. Network errors:

    • Check your internet connection and ensure the correct environment (sandbox or production) is specified.

Handling Redirect Links

The SDK internally handles redirect links for the payment flow. Use the onPaymentStatus callback to capture the final payment status based on the navigation state.


Notes

  • For production, ensure the environment prop is set to "production".
  • Test the integration thoroughly in the sandbox environment before switching to production.

For further assistance, please contact Deema Support.