Google 应用内购买始终会获得退款
Posted
技术标签:
【中文标题】Google 应用内购买始终会获得退款【英文标题】:Google In-App Purchase are always refunded 【发布时间】:2020-08-01 19:34:33 【问题描述】:我在使用 Google 应用内购买时遇到了一些问题。所有收到的付款将在 72 小时后退还。我的付款代码有错误吗?我自己付了钱,没有要求任何退款,但即便如此,72 小时后还是退款了。
play_console_screenshot
private void setupBilling()
mBillingClient = BillingClient.newBuilder(MainActivity.this).setListener(this).enablePendingPurchases().build();
mBillingClient.startConnection(new BillingClientStateListener()
@Override
public void onBillingSetupFinished(BillingResult billingResult)
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK)
final List<String> skuList = new ArrayList<> ();
skuList.add("remove_ads");
final SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
mBillingClient.querySkuDetailsAsync(params.build(), new SkuDetailsResponseListener()
@Override
public void onSkuDetailsResponse(BillingResult billingResult, List<SkuDetails> list)
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK && list != null)
BillingFlowParams flowParams = BillingFlowParams.newBuilder()
.setSkuDetails(list.get(0))
.build();
mBillingClient.launchBillingFlow(MainActivity.this, flowParams);
);
else
Toast.makeText(MainActivity.this, "error", Toast.LENGTH_SHORT).show();
@Override
public void onBillingServiceDisconnected()
Toast.makeText(MainActivity.this, "error", Toast.LENGTH_SHORT).show();
);
@Override
public void onPurchasesUpdated(BillingResult billingResult, @Nullable List<Purchase> list)
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK
&& list != null)
for (Purchase purchase : list)
if(purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED)
Toast.makeText(MainActivity.this, purchase.getSku() + " ok", Toast.LENGTH_SHORT).show();
else if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.USER_CANCELED)
Toast.makeText(this, "İptal edildi", Toast.LENGTH_SHORT).show();
else if(billingResult.getResponseCode() == BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED)
Toast.makeText(this, "alreadry owned", Toast.LENGTH_LONG).show();
else
Toast.makeText(this, "error", Toast.LENGTH_SHORT).show();
【问题讨论】:
【参考方案1】:您似乎没有正确确认购买。
如果您使用 Google Play 结算库 2.0 版或更高版本,您 必须在三天内确认所有购买。未能正确 确认购买会导致这些购买被退款。
您可以在文档中找到更多详细信息:https://developer.android.com/google/play/billing/billing_library_overview#acknowledge
BillingClient client = ...
AcknowledgePurchaseResponseListener acknowledgePurchaseResponseListener = ...
void handlePurchase(Purchase purchase)
if (purchase.getPurchaseState() == PurchaseState.PURCHASED)
// Grant entitlement to the user.
...
// Acknowledge the purchase if it hasn't already been acknowledged.
if (!purchase.isAcknowledged())
AcknowledgePurchaseParams acknowledgePurchaseParams =
AcknowledgePurchaseParams.newBuilder()
.setPurchaseToken(purchase.getPurchaseToken())
.build();
client.acknowledgePurchase(acknowledgePurchaseParams, acknowledgePurchaseResponseListener);
【讨论】:
用户在我们的应用中支付了应用内购买,但谷歌在 72 小时 10 分钟后自动退款,我不知道为什么会发生这种情况。我将所有代码作为颤振文档进行,并在下面添加(app/build.gradle)依赖项 implementation 'com.android.billingclient:billing:2.0.3' 但每次用户用户支付应用内购买但谷歌自动72 小时和 10 分钟后退款。请问有什么解决办法吗? (颤振应用) 即使添加了付款也会退还。对此有任何想法吗?以上是关于Google 应用内购买始终会获得退款的主要内容,如果未能解决你的问题,请参考以下文章
使用Google Play计费库和系统会在3天之内退还Inapp产品的退款
google应用内购(in app billing),点击购买无响应
Google Play 应用内购买返回错误代码 -1008:null puchaseData 或 dataSignature