From 2a115b5d25d24d2e714a78c2323bb0794ad2c740 Mon Sep 17 00:00:00 2001 From: Jason Divock Date: Fri, 25 Mar 2022 14:28:36 -0600 Subject: [PATCH 1/4] add android steps --- docs/set-up-your-sdk.md | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/docs/set-up-your-sdk.md b/docs/set-up-your-sdk.md index 63e9ec35..0861140f 100644 --- a/docs/set-up-your-sdk.md +++ b/docs/set-up-your-sdk.md @@ -124,9 +124,7 @@ Please read the [Android documentation](https://developer.android.com/about/vers ## Usage With Expo -_Note: Currently Expo is only supported for usage with iOS, we will resume support for android when expo update its `compileSdkVersion` to 31_ - -_Note: This package cannot be used in the "Expo Go" app because [it requires custom native code](https://docs.expo.io/workflow/customizing/)._ +> Note: This package cannot be used in the "Expo Go" app because [it requires custom native code](https://docs.expo.io/workflow/customizing/). After [installing](#installation) the SDK, add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`: @@ -150,7 +148,39 @@ After [installing](#installation) the SDK, add the [config plugin](https://docs. } ``` -That's it, that will take care of all android and iOS permissioning required for the SDK to function! +### Android + +For android you'll need to massage your build files in order to properly compile. First in `android/build.gradle` by updating both `compileSdkVersion` and `targetSdkVersion` to at least `31`: + +``` +buildscript { + ext { + buildToolsVersion = "29.0.3" + minSdkVersion = 21 + compileSdkVersion = 31 + targetSdkVersion = 31 + } +``` + +Next ensure that jetifier is ignoring the `mochi` lib by adding the following to `android/gradle.properties`: + +``` +android.jetifier.ignorelist=moshi-1.13.0.jar +``` + +or + +``` +android.jetifier.blacklist=moshi-1.13.0.jar +``` + +Depending on the version of jetifier in use. + +### iOS + +No special steps required! + +### Build Next, rebuild your app as described in the ['Adding custom native code'](https://docs.expo.io/workflow/customizing/) guide with: From a171cc39cfe70bd1fdc0bd228cad9ea8f2f0b2f6 Mon Sep 17 00:00:00 2001 From: Jason Divock Date: Fri, 25 Mar 2022 14:31:10 -0600 Subject: [PATCH 2/4] shuffle --- docs/set-up-your-sdk.md | 44 +++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/docs/set-up-your-sdk.md b/docs/set-up-your-sdk.md index 0861140f..0118b811 100644 --- a/docs/set-up-your-sdk.md +++ b/docs/set-up-your-sdk.md @@ -126,28 +126,6 @@ Please read the [Android documentation](https://developer.android.com/about/vers > Note: This package cannot be used in the "Expo Go" app because [it requires custom native code](https://docs.expo.io/workflow/customizing/). -After [installing](#installation) the SDK, add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`: - -```json -{ - expo: { - // ... - "plugins": [ - [ - "stripe-terminal-react-native", - { - "bluetoothBackgroundMode": true, - "locationWhenInUsePermission": "Location access is required in order to accept payments.", - "bluetoothPeripheralPermission": "Bluetooth access is required in order to connect to supported bluetooth card readers.", - "bluetoothAlwaysUsagePermission": "This app uses Bluetooth to connect to supported card readers." - } - ], - … - ] - } -} -``` - ### Android For android you'll need to massage your build files in order to properly compile. First in `android/build.gradle` by updating both `compileSdkVersion` and `targetSdkVersion` to at least `31`: @@ -176,9 +154,27 @@ android.jetifier.blacklist=moshi-1.13.0.jar Depending on the version of jetifier in use. -### iOS +### Configuring the SDK + +After [installing](#installation) the SDK, add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`: -No special steps required! +```json +{ + "expo": { + "plugins": [ + [ + "stripe-terminal-react-native", + { + "bluetoothBackgroundMode": true, + "locationWhenInUsePermission": "Location access is required in order to accept payments.", + "bluetoothPeripheralPermission": "Bluetooth access is required in order to connect to supported bluetooth card readers.", + "bluetoothAlwaysUsagePermission": "This app uses Bluetooth to connect to supported card readers." + } + ] + ] + } +} +``` ### Build From 21fbe8ec8a952ddd8fb0e3dea75f0fb9705b371c Mon Sep 17 00:00:00 2001 From: Jason Divock Date: Fri, 25 Mar 2022 14:57:55 -0600 Subject: [PATCH 3/4] update both files --- README.md | 46 +++++++++++++++++++++++++++++++++-------- docs/set-up-your-sdk.md | 2 +- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 67ea0600..5e09eabf 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ Stripe Terminal enables you to build your own in-person checkout to accept payme - [Usage With Expo](#usage-with-expo) - [Example Code](#example-code) - [Initialization](#initialization) - - [Hooks and Events](#hooks-and-events) - - [Common Operations](#common-operations) + - [Discovering Devices](#discovering-devices) + - [More Examples](#more-examples) - [Additional Docs](#additional-docs) - [Internal Docs](#internal-docs) - [Contributing](#contributing) @@ -172,10 +172,38 @@ Please read the [Android documentation](https://developer.android.com/about/vers ## Usage With Expo -> Note: Currently Expo is only supported for usage with iOS, we will resume support for android when expo updates its `compileSdkVersion` to 31 - > Note: This package cannot be used in the "Expo Go" app because [it requires custom native code](https://docs.expo.io/workflow/customizing/). +### Android + +For android you'll need to massage your build files in order to properly compile. First in `android/build.gradle` by updating both `compileSdkVersion` and `targetSdkVersion` to at least `31`: + +``` +buildscript { + ext { + buildToolsVersion = "29.0.3" + minSdkVersion = 21 + compileSdkVersion = 31 + targetSdkVersion = 31 + } +``` + +Next ensure that jetifier is ignoring the `moshi` lib by adding the following to `android/gradle.properties`: + +``` +android.jetifier.ignorelist=moshi-1.13.0.jar +``` + +or + +``` +android.jetifier.blacklist=moshi-1.13.0.jar +``` + +Depending on the version of jetifier in use. + +### Configuring the SDK + After [installing](#installation) the SDK, add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`: ```json @@ -196,9 +224,9 @@ After [installing](#installation) the SDK, add the [config plugin](https://docs. } ``` -That's it, that will take care of all android and iOS permissioning required for the SDK to function! +### Build -Then, rebuild your app as described in the ['Adding custom native code'](https://docs.expo.io/workflow/customizing/) guide with: +Next, rebuild your app as described in the ['Adding custom native code'](https://docs.expo.io/workflow/customizing/) guide with: ``` expo run:ios @@ -245,7 +273,7 @@ function Root() { ``` As a last step, simply call `initialize` method from `useStripeTerminal` hook. -Please note that `initialize` method must be called from a nested component of `StripeTerminalProvider`. +Please note that `initialize` method must be called from the nested component of `StripeTerminalProvider`. ```tsx // App.tsx @@ -262,7 +290,7 @@ function App() { } ``` -## Hooks and Events +## Discovering Devices Stripe Terminal SDK provides dedicated hook which exposes bunch of methods and props to be used within your App. Additionally, you have access to the internal state of SDK that contains information about the current connection, discovered readers and loading state. @@ -337,7 +365,7 @@ import { export default withStripeTerminal(PaymentScreen); ``` -## Common Operations +## More Examples You can find further examples of common SDK actions here: diff --git a/docs/set-up-your-sdk.md b/docs/set-up-your-sdk.md index 0118b811..6ac9ad72 100644 --- a/docs/set-up-your-sdk.md +++ b/docs/set-up-your-sdk.md @@ -140,7 +140,7 @@ buildscript { } ``` -Next ensure that jetifier is ignoring the `mochi` lib by adding the following to `android/gradle.properties`: +Next ensure that jetifier is ignoring the `moshi` lib by adding the following to `android/gradle.properties`: ``` android.jetifier.ignorelist=moshi-1.13.0.jar From abc6eeaffb405d9c9f42f755130e9eaa2812d3fe Mon Sep 17 00:00:00 2001 From: Jason Divock Date: Fri, 25 Mar 2022 15:01:41 -0600 Subject: [PATCH 4/4] toc --- README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5e09eabf..41e95dec 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,13 @@ Stripe Terminal enables you to build your own in-person checkout to accept payme - [Permissions](#permissions-1) - [Manifest](#manifest) - [Usage With Expo](#usage-with-expo) + - [Android](#android-2) + - [Configuring the SDK](#configuring-the-sdk) + - [Build](#build) - [Example Code](#example-code) - [Initialization](#initialization) - - [Discovering Devices](#discovering-devices) - - [More Examples](#more-examples) + - [Hooks and Events](#hooks-and-events) + - [Common Operations](#common-operations) - [Additional Docs](#additional-docs) - [Internal Docs](#internal-docs) - [Contributing](#contributing) @@ -226,7 +229,7 @@ After [installing](#installation) the SDK, add the [config plugin](https://docs. ### Build -Next, rebuild your app as described in the ['Adding custom native code'](https://docs.expo.io/workflow/customizing/) guide with: +Rebuild your app as described in the ['Adding custom native code'](https://docs.expo.io/workflow/customizing/) guide with: ``` expo run:ios @@ -273,7 +276,7 @@ function Root() { ``` As a last step, simply call `initialize` method from `useStripeTerminal` hook. -Please note that `initialize` method must be called from the nested component of `StripeTerminalProvider`. +Please note that `initialize` method must be called from a nested component of `StripeTerminalProvider`. ```tsx // App.tsx @@ -290,7 +293,7 @@ function App() { } ``` -## Discovering Devices +## Hooks and Events Stripe Terminal SDK provides dedicated hook which exposes bunch of methods and props to be used within your App. Additionally, you have access to the internal state of SDK that contains information about the current connection, discovered readers and loading state. @@ -365,7 +368,7 @@ import { export default withStripeTerminal(PaymentScreen); ``` -## More Examples +## Common Operations You can find further examples of common SDK actions here: