Super Payments SDK for ReactNative

Super React Native SDK

The Super React Native SDK allows you to use Super Payments in your native Android and iOS apps using React Native.

We do not support Expo projects yet.

Installation

Shell

yarn add @superpayments/super-react-native
or
npm install @superpayments/super-react-native

Dependencies

This library needs these dependencies to be installed in your project before you can use it:

Shell

yarn add @gorhom/bottom-sheet@^5 react-native-reanimated react-native-gesture-handler
or
npm install @gorhom/bottom-sheet@^5 react-native-reanimated react-native-gesture-handler

Link dependencies

From react-native: 0.60 autolinking will take care of the link step.

Android

iOS

Requirements

Android

iOS

Components and props

SuperPaymentsProvider

useSuperPayments

Usage example

tsx

import { SuperPaymentsProvider } from '@superpayments/super-react-native';

// App.tsx
const App = () => {
  return (
    <SuperPaymentsProvider sheetProps={{
      maxHeightPercentage: '80%',
      displayHandle: false,
      displayCloseButton: true,
    }}>
      <CustomComponent />
    </SuperPaymentsProvider>
  );
};

// PaymentScreen.tsx
import { useSuperPayments } from '@superpayments/super-react-native';

const PaymentScreen = () => {
  const { presentPaymentSheet } = useSuperPayments();

const handlePress = () => {
    presentPaymentSheet({
      url: paymentUrl // url from the API integration
      customStyles: {
        payButton: {
          backgroundColor: '#ff8f00',
          fontColor: '#000000',
        },
      },
      // Payment Sheet will close automatically
      onPaymentSuccess: () => {
        // Payment Success
      },
      // Payment Sheet will close automatically
      onPaymentFailed: () => {
        // Payment Failed
      },
    });
  };

return <Button onPress={handlePress} title="Pay" />;
};

Setup for development

Once these steps are you should be able to run the app from the command line, xcode or Android Studio.