在Android版应用帐单中实施React Native?

问题描述:

我正在尝试使用react-native-billing添加In App Purchase for Play商店,但不知道该怎么做。在Android版应用帐单中实施React Native?

谷歌似乎无法找到在应用内结算的任何教程

我所见过的example它看起来像这样

InAppBilling.open() 
     .then(() => InAppBilling.purchase('android.test.purchased')) 
     .then((details) => { 
      this.setState({ 
       purchaseText: details.productId 
      }); 
      return InAppBilling.getProductDetails('android.test.purchased'); 
     }) 
     .then((productDetails) => { 
      this.setState({ 
       productDetailsText: productDetails.title 
      }); 
      return InAppBilling.close(); 
     }) 
     .catch((error) => { 
      this.setState({ 
       error: error 
      }); 
     }); 

这是很简单的。但我不明白的是android.test.purchased

也许这就是BCZ我的知识缺乏有关的In App Purchase在Android

我还没有得到什么details & productDetails &在哪里实施这些

如何实现它?

我没有看到In App Products下拉框中写的是什么。它被写入To add in-app products, you need to add the BILLING permission to your APK.现在我可以执行。

android.test.purchased是一种测试应用程序内购买用于调试目的的方法(更多资源:https://developer.android.com/google/play/billing/billing_testing.html)。

+0

我们如何在'then'中获得'details'? – deadcoder0904