PeterStaev / nativescript-purchase

:moneybag: A NativeScript plugin for making in-app purchases!
Apache License 2.0
83 stars 28 forks source link

Nativescript-Vue implementation #76

Closed marayshi closed 5 years ago

marayshi commented 5 years ago

How i can use the plugin with nativescript-vue Can you provide some tips to do that ?

PeterStaev commented 5 years ago

Hey @mobeelco , this plugin does not have anything UI related. So implementation in Vue, Angular and Core is the same and there aren't any differences.

marayshi commented 5 years ago

Hi @PeterStaev I just dont know how to write this by Nativescript-vue Can you help just convert this to Vue ?

import * as purchase from "nativescript-purchase"; (global as any).purchaseInitPromise = purchase.init(["com.sample.purchase.coolproduct1", "com.sample.purchase.coolproduct2"]);

import { Product } from "nativescript-purchase/product";

(global as any).purchaseInitPromise.then(() => { purchase.getProducts().then((products: Array) => { products.forEach((product: Product) => { console.log(product.productIdentifier); console.log(product.localizedTitle); console.log(product.priceFormatted); }); }); });

PeterStaev commented 5 years ago

@mobeelco , I'm not a vue developer so I cant help you. But from what I know vue is still based on Typescript, so the code above should work out of the box. Same goes for angular.

marayshi commented 5 years ago

@PeterStaev I using Javasscript not typescript I trying now i think the code work but i getting error JS: [Error: Response from service: 3] when purchase.getProducts() any idea ?

PeterStaev commented 5 years ago

Hey @mobeelco , looking here seems the reason why you get this error code is that you havent set up fully billing or your device does not allow in app billing:

The Google Play Billing AIDL version is not supported for the type requested

Make sure you have accepted all Google agreements, and also follow the step by step guide linked at the bottom of the readme when you are setting up the play stores. Initial configuration is a real PITA 😭

PeterStaev commented 5 years ago

No further response so closing this one for now. In case you still have problems, please provide more details.