React Native SDK
Learn how to integrate Safepay into your React Native mobile application
A set of components allowing easy integration of Safepay Button and Safepay Checkout into your website, powered by zoid
1. Install through NPM or Yarn
In your project root you can run either one of the below commands (depending on what package manager you use)
Yarn
NPM
Install using Yarn:
2. Add react-native-webview to your dependencies
Yarn
NPM
Install using Yarn:
3. Import
Import Safepay class from safepay library
4. Create a Safepay client by passing your config
You can now create payments and checkout links.
5. Set currency and amount
Since we're huge fans of React at Safepay, we've integrated this library into our products like Quick Links through the following React integration that ships out of the box with this library
6. Export the component
Since we're huge fans of React at Safepay, we've integrated this library into our products like Quick Links through the following React integration that ships out of the box with this library
7. Implement your styling here
Since we're huge fans of React at Safepay, we've integrated this library into our products like Quick Links through the following React integration that ships out of the box with this library
Ending Step
Since we're huge fans of React at Safepay, we've integrated this library into our products like Quick Links through the following React integration that ships out of the box with this library
Ending Step
Since we're huge fans of React at Safepay, we've integrated this library into our products like Quick Links through the following React integration that ships out of the box with this library
Feedback
What do you think of our integration document? Let us know here support@getsafepay.com
import React from 'react';import SafepayCheckout from '@sfpy/react-native-sdk';import {StyleSheet} from 'react-native';const Home: React.FC = () => {return (<><SafepayCheckoutcurrency="PKR"amount={1000}clientKey="sec_xxxx-yourkey"environment={environment.SANDBOX}order_id="12345"buttonStyle={styles.button}buttonTheme={theme.DEFAULT}onPaymentCancelled={() => Alert.alert('Payment Cancelled!')}onPaymentComplete={() => Alert.alert('Payment Successfull')}onErrorFetchingTracker={() => {Alert.alert('error fetching tracker id')}/></>);};export default Home;