Square Reader SDK for React Native
Tags: javascript, react, reactnative, payments
Published: 2018-10-01 18:43:31

---
title: Square Reader SDK for React Native
published: true
description: We released a React Native plug-in for our Square Reader SDK.
tags: javascript, react, react-native, payments
canonical_url: https://developer.squareup.com/blog/square-reader-sdk-for-react-native/
cover_image: https://images.ctfassets.net/1wryd5vd9xez/6jrDWr0LqJJ4G3tBHlrt7P/24764e319c78eb8fbd71ed188106d551/https___cdn-images-1.medium.com_1_uDt7VsWk7CFI50kTUZzSYg.jpeg?w=1458&h=400&q=100&fm=webp&fit=fill&bg=rgb%3A000000
---

In the beginning of August, we announced the release of our [Reader SDK](https://squareup.com/developers/reader-sdk) for iOS and Android to allow developers to build their own custom in-person payment experiences.

Now, we’ve taken that ground-breaking SDK and wrapped it up in a React Native plugin that you can use in your own React Native project. So whether you’re a cross-platform guru looking to creating the ultimate in-person payment experience or just a React hacker looking to try out something new, you can now `npm install react-native-square-reader-sdk` in your project *(just be sure to read our [quick start guide](https://github.com/square/react-native-square-reader-sdk/tree/master/reader-sdk-react-native-quickstart) on getting the native dependencies installed)*.

We released a React Native plugin for our Reader SDK to allow developers to more easily and rapidly create new in-person payment applications. We know that iOS and Android developers can just as easily use the native SDK, but here we can reach *any* JavaScript developer. We even have a [quick-start](https://github.com/square/react-native-square-reader-sdk/tree/master/reader-sdk-react-native-quickstart) application that can give you a starting place for creating your very own point of sale, kiosk, or custom in-person payment experience. It’s as easy as tweaking some JSX, or creating your own components, and then connecting them to the interfaces we’ve provided.

**It’s possible to get an app up and running locally within five minutes.** I was even able to get a custom keypad, entering arbitrary values, in an hour (granted, I was a little rusty on my React Native when I was trying it). I’m also very much not a mobile developer, and having the application running on an iPhone and Android simulator simultaneously was so powerful for having a responsive feedback loop when developing. You can enable live reloading on each device and have all your changes reflected immediately upon saving.

![Live reloading a React Native Square Reader app in iOS and Android simultaneously!](//downloads.ctfassets.net/1wryd5vd9xez/5PxRRCwiNi6j1MCgJxHgKz/3fa7de2d3a44061d8b14b0850f260c62/https___cdn-images-1.medium.com_max_3840_1_Mw1dOzMhFLZn-FMsMQdLKg.gif)*Live reloading a React Native Square Reader app in iOS and Android simultaneously!*

Let’s say you take our quick-start app out for a spin and are looking to just get your feet wet in making your own point of sale app.

You can open up `[reader-sdk-react-native-quickstart/app/screens/CheckoutScreen.js`](https://github.com/square/react-native-square-reader-sdk/blob/master/reader-sdk-react-native-quickstart/app/screens/CheckoutScreen.js) and start modifying some of the buttons to adjust the amounts that you’re charging.

Then add some additional buttons that look like this:

```html
<KeyPadButton
  title="1"
  onPress={() => this.addValue(1)}
  primary
/>
```

The above is just a modified version of the provided [`CustomButton`](https://github.com/square/react-native-square-reader-sdk/blob/master/reader-sdk-react-native-quickstart/app/components/CustomButton.js) component to look a little different. We then add in our own function for adding a value:

```js
addValue(value) {
  this.setState((prevState) => {
    return {
      currentValue: [...prevState.currentValue, value],
    };
  });
}
```

and add a `currentValue` array to the state of our `CheckoutScreen` component:

```js
class CheckoutScreen extends Component {
  constructor(props) {
    super(props);
    this.state = {
      currentValue: [0, 0],
    };
  }
```

You now have your own keypad to enter amounts to charge.

![](//images.ctfassets.net/1wryd5vd9xez/7aYw4nYAU3eJoFfI9IEa8w/41f85e0e5b181a0066c736c8db7bd2f2/https___cdn-images-1.medium.com_max_2000_1_CfyhDYh7qfcoE0K2KoHJnA.gif)

Here you can see what a final custom keypad looks like. We have buttons for every number, we can clear values, and we’re just storing the current value we want to charge in the main `CheckoutScreen` component. The state even persists if we back out of the charge.

**It’s so easy to modify these interfaces!** You can change the text, add in some additional state, or create custom functions to tailor the application to do whatever you need. The key benefit here is that you can then deploy this to iOS and Android using the same core components.

**This is really just scratching the surface**, since these are only simple modifications to the [quick-start application](https://github.com/square/react-native-square-reader-sdk/tree/master/reader-sdk-react-native-quickstart). We are looking forward to seeing what the React Native community creates with this new plugin. Whether you want to make the next self-ordering kiosk, create a whole new point of sale for your favorite industry, or just be the first to build a React Native application with it — we want to hear about it!

Tweet us at [@SquareDev](https://twitter.com/@SquareDev) or join us in our slack community over at [https://squ.re/slack](https://squ.re/slack).

Also, if you just want to contribute to the [open-source project on GitHub](https://github.com/square/react-native-square-reader-sdk/), feel free to give it a fork and submit a PR to us!