将developerPayload插入到getBuyIntent()方法中

时间:2017-06-26 09:15:58

标签: android google-play in-app-billing

我尝试通过com.android.billingclient:billing-dp1库制作Google Play结算服务。我尝试通过调用以下方式开始结算过程:

billingClient.launchBillingFlow(activity, params);

所以问题是如何通过" developerPayload"这个流程的论点? launchBillingFlow及其params参数都不包含此类字段。

3 个答案:

答案 0 :(得分:0)

你不能,如果你看一下BillingClientImpl的来源,你会看到这个:

buyIntentBundle =
        mService.getBuyIntent(3, mContext.getPackageName(), newSku, skuType, null);

最后nulldeveloperPayload

Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type,
    String developerPayload);

所以,还没有developerPayload的实现。

答案 1 :(得分:0)

InitiatePurchase命令是否用于结算?因为您在InitiatePurchase命令中传递了developerPayload ...

string developerPayload = "the info you are passing in the developerPayload";   
m_storeController.InitiatePurchase (product, developerPayload);

就是这样。

答案 2 :(得分:0)

最近我向开发者开了一个问题'页面,他们回答了以下问题:

我刚刚发现developerPayload并不总是有效。在某些情况下,例如在使用促销代码时,稍后调用getPurchases()将不包含已发送的信息。这种限制使developerPayload无用。谷歌的官方立场是它不应该用于安全目的,即使一堆文档和官方的Trivial Drive示例另有说法。希望这能为您节省一些时间。

查看详情here