为什么在查询Purchases.subscriptions资源时developerPayload字段为空?

时间:2019-05-28 10:56:48

标签: android .net-core google-play android-billing

我正在使用 Google Play结算库实现应用内订阅。 一切正常,除非有人想到,当我确认购买商品时,将 developerPayload 设置为某个字符串值。然后,我可以在应用程序中查询购买时看到此值,但是当我在后端中使用Google Developer Api验证订阅时, developerPayload 字段为空,其他所有字段字段正确。

我的后端是用.NET core 2.2编写的,并且我正在使用 Google.Apis.AndroidPublisher.v3 库。 我还检查了python库,结果是一样的。

这就是我准备确认参数的方式, developerPayload 只是一个大约60个字符的简单字符串。

val params = AcknowledgePurchaseParams.newBuilder()
.setDeveloperPayload(developerPayload)
.setPurchaseToken(purchase.purchaseToken)
.build()

billingClient.acknowledgePurchase(params) { billingResult ->
...
}

1 个答案:

答案 0 :(得分:0)

我正面临着同样的问题 这是我请求Google Api时的响应

  

{类型:'androidpublisher#subscriptionPurchase',startTimeMillis:   '1564065118619',到期时间为毫秒数:'1564065536468',自动更新:   true,priceCurrencyCode:“ SAR”,priceAmountMicros:“ 10990000”,
  countryCode:“ SA”,developerPayload:”,payingState:1,
  orderId:“ GPA.3399-9037-3439-13416”,purchaseType:0,
  ConfirmationState:0}

并且可以从Android发送

from nltk import word_tokenize
from nltk.corpus import stopwords
stop = set(stopwords.words('english'))
sentence = 'I love coding'
print([i for i in sentence.lower().split() if i not in stop])
>>> ['love', 'coding']
print(" ".join([i for i in sentence.lower().split() if i not in stop]))
>>> "love coding"
相关问题