# Tyro React Native SDK

The Tyro React Native SDK is a specialised JavaScript library for React Native provided by Tyro.
It provides a simple interface to integrate with the Pay API from your React Native application.
You can embed our pay sheet provided by our SDK in your apps checkout flow and submit payments via our Pay API
using supported cards or wallet payments via Apple and Google Pay.

# Recommended Usage

Apple and Google stores have requirements over in-app purchases such as purchasing in-app subscriptions or purchases to unlock additional app features.
If your app offers these types of purchases then it must use their respective APIs, otherwise you can use Tyro's React Native SDK for the Pay API.
See the terms for [Apple](https://developer.apple.com/app-store/review/guidelines/#payments) and [Google](https://support.google.com/googleplay/android-developer/answer/9858738?hl=en&ref_topic=9857752) respectively for more information.

# Installing Tyro React Native SDK

## Install Tyro React Native Dependency

Github Personal Access Token (PAT)
is required to download the SDK.

Steps to setup the PAT:

- Navigate to GitHub page, **Profile** -> **Settings** -> **Developer Settings**
- On the left panel, select **Personal Access Token** -> **Token(classic)**
- Generate a new token with `repo` and `read:package` permissions


Next, create a .npmrc file and be sure to use the PAT
where it says `YOUR_GITHUB_PACKAGES_TOKEN` in the example below.


```javascript
@tyro:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${YOUR_GITHUB_PACKAGES_TOKEN}
```

Then you can install the package using npm or yarn


```npm
npm install @tyro/tyro-pay-api-react-native
```


```yarn
yarn add @tyro/tyro-pay-api-react-native
```

## iOS

### Requirements

- Xcode `14.0` or later
- iOS `14` or later


### Install Native Dependencies


```terminal
// navigate to your ios directory to install dependencies
pod install
```

## Android

### Requirements

Make sure your app's build file uses the following values:

- A `minSdkVersion` of `23` or higher
- A `compileSdkVersion` of `31` or higher


### Install Native Dependencies


```javascript
npm install react-native-svg react-native-webview
```