nativescript-square-reader
Allows you to accept payments through square without leaving your app. iOS only (for now) works on iOS 11+
npm i --save nativescript-square-reader
- Version: 1.0.6
- GitHub:
- NPM: https://www.npmjs.com/package/nativescript-square-reader
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 0
NativeScript Square Reader
iOS only (for now) nativescript plugin for the Square Reader SDK https://squareup.com/us/en/developers/reader-sdk
Note: will only work for iOS 11+. To support older versions, consider using https://github.com/fhackenb/nativescript-square-plugin
Installation
tns plugin add nativescript-square-reader
Setup
iOS setup guide: https://docs.connect.squareup.com/payments/readersdk/setup-ios
tns plugin add nativescript-square-reader
- Follow steps 1 - 2 on the above list to get a SquareReaderSDK.framework
- Add the SquareReaderSDK.framework to your build path
- Update your Info.plist with usage descriptions (Step 3 from link)
- Get an auth code https://docs.connect.squareup.com/payments/readersdk/mobile-authz-guide
- Get coding!
Usage
See demo app for more detailed example usage
Authenticate:
this.squareReader = new SquareReader();
this.squareReader.authenticate(this.code)
.then( (res: SquareAuthStatus) => {
if (res.code === 0) {
// authenticated
} else {
// not authenticated
}
});
Check out:
this.squareReader.startCheckout(100, this.page.ios)
.subscribe( (result: SquareCheckoutResult) => {
switch (result.status) {
case 1:
console.log("Cancelled!");
break;
case 2:
console.log("Failed!");
break;
case 0:
console.log("Succeeded!");
console.log("LocationId:", result.checkoutResult.locationID);
console.log("Tenders:", result.checkoutResult.tenders);
break;
}
});
License
Apache License Version 2.0, January 2004