React Native Library
Note:
A React Native package based on the PosBuddy Javascript Library.
The react-native-thumbzup-pos-buddy
library uses secure WebSockets to communicate with Thumbzup Pay® servers.
This connects your application to your payment device, which has the Thumbzup PoS Buddy client & Thumbzup Pay® installed on it.
Your application can then process payments using your payment device
Installation
If you have an existing project, install the plugin using your package manager:
 yarn add react-native-thumbzup-pos-buddy
(If you don't have an existing project & are setting up React Native for the first time, please see React Native Environment Setup below.)
Note:
If you don't have an existing project & are setting up React Native for the first time, please see React Native Environment Setup page
React Native Environment Setup
MacOS
Follow the official React Native Expo Go Quickstart and:
- If you are installing yarn for the first time, enable corepack using corepack enable then npm install --global yarn.
- Install project dependencies by running yarn.
- Run the demo using yarn demo web.
Windows
Adapting the official React Native Windows CLI Quickstart:
- Install nvm-windows.
- Check the installed node version using nvm list.
- Install Chocolatey using the individual administrative shell script.
- Validate installation using choco -v.
- Install the recommended JDK using choco install -y microsoft-openjdk17.
- Validate which version is in use using echo %JAVA_HOME%.
- Enable corepack using corepack enable.
- Install yarn using npm install --global yarn.
- Install project dependencies by running yarn.
- Run the demo using yarn demo web.
Usage
The PosBuddy demo Expo application in /demo
implements react-native-thumbzup-pos-buddy
for Android, iOS & web platforms.
You should be able to run the web demo out of the box by installing the project's dependencies:
yarn
And then running the web platform:
yarn web demo
(For reference, please follow the React Native Getting Started guide for Expo.)
Basics
In a nutshell, one would:
- Create a PosBuddy instance,
- Connect to your device,
- Authenticate your application, &
- Perform sales.
Note
In practice, there are a number of states & lifecycle recommendations which you can find in the Complete Implementation.
Please refer to API reference section or click the link below:
Complete Implementation
The PosBuddy Demo app demonstrates each react-native-thumbzup-pos-buddy
feature including:
- Connection
- Logging
- Authentication
- Displaying items
- Payments
- Refunds
Caveats
Android Secure WebSockets (WSS)
Depending on your Android device or OS, you may experience WebSocket errors:
 java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
Example implementation using React Native Library:
import { PosBuddy } from 'react-native-thumbzup-pos-buddy';
​
const posBuddy = new PosBuddy();
​
// Your device identifier is displayed in the Thumbzup PoS Buddy client on your payment device.
posBuddy.connect('device identifier', (nextStatus: PbStatus) =>
console.log('Connection status', nextStatus)
);
​
// Authenticate.
posBuddy.setPosId(appKey);
posBuddy.setMerchantId(merchantId);
posBuddy.setAuthenticationKey(authenticationKey);
posBuddy.doPosAuth(({ secretKey, accessKey }) => {
// Keep `obj.authenticationKey` for your session.
});
​
// Make a payment.
posBuddy.doPayment(totalAmountInCents, (obj: any) => {
// View the payment outcome in the `obj.receiptBundle`.
});
Updated about 1 month ago