defold / extension-iap

In-app purchase extension for Defold
MIT License
19 stars 12 forks source link

Issue when purchase testing Android IAP product using "Slow test card" method #50

Open RedHunter7 opened 1 year ago

RedHunter7 commented 1 year ago

Bug Description https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474

When using "Slow test card, approves after few minutes" method on purchase testing, the transaction state become error with reason iap.REASON_UNSPECIFIED. After 3-5 minutes, transaction state become iap.TRANS_STATE_PURCHASED.

Same with "Slow test card, declines after few minutes", the transaction state also become error with reason iap.REASON_UNSPECIFIED. But after 3-5 minutes, the API does not give any information if transaction is fail/error.

Expected behaviour

  1. On method "Slow test card, approves after few minutes", the transaction state should become PENDING. After few minutes, transaction state becomes PURCHASED
  2. On method "Slow test card, declines after few minutes", the transaction state should become PENDING. After few minutes, transaction state becomes FAILED or error
britzl commented 1 year ago

I'm not able to reproduce this when testing with the recent extension update to Google Play Billing Version 5

britzl commented 1 year ago

User has tested on Samsung A32 (Android 12) & Google Pixel 4 (Android 11)

image

dri-richard commented 9 months ago

We also see this. Slightly different output. This is on a Xiaomi-MI 9, Android 10.

ERROR:IAPEXT: IAP error 5
DEBUG:SCRIPT: IAP Error
DEBUG:SCRIPT: {
error = "failed to buy product",
reason = 0
}
dri-richard commented 9 months ago

I suspect that the default auto-completion option assumes a sequence & timing of events that is incompatible with that caused by the slow test card option (and presumably, the real-life equivalent situation)

britzl commented 9 months ago

We also see this. Slightly different output. This is on a Xiaomi-MI 9, Android 10.

ERROR:IAPEXT: IAP error 5
DEBUG:SCRIPT: IAP Error
DEBUG:SCRIPT: {
error = "failed to buy product",
reason = 0
}

How are you testing this? Last time I tried I failed to repro the issue.

dri-richard commented 9 months ago

To reproduce:

  1. In game project, remove iap.auto_finish_transactions = 0 (the default setting is 1, i.e. enabled)
  2. Modify the Android bundle ID, and the product IDs in main.gui_script as required
  3. Bundle and run
  4. Click 'Goldbars - S'
  5. Ensure the 'Slow test card. Approves after a few minutes' option is set in the Google Play overlay.
  6. Purchase
  7. Observe the error in logcat.
britzl commented 7 months ago

7. Observe the error in logcat.

I tried reproducing this issue using the instructions above but to no avail. Here's me being it:

11-07 23:56:29.979 24424 24424 D IapGooglePlay: billingResponseCodeToDefoldResponse: 0 defoldResponse: 0
11-07 23:56:29.979 24424 24424 D IapGooglePlay: convertPurchase() original json: {"orderId":"GPA.3381-8816-4353-20615","packageName":"com.defold.extension.iap","productId":"com.defold.iap.goldbar.small","purchaseTime":1699397788166,"purchaseState":4,"purchaseToken":"hbalapelmcaccckkiidohkpo.AO-J1OyCmHpgSbma5UVLk27munHw8ERPvjoSwxMs99-S_wpCSs1sQnTBR6rdXud8hUIPCt5z3-owy6WHtyrff66Yac8GK30NdlBW1R3KWYIewMj5nrktvSQ","quantity":1,"acknowledged":false}

And one minute later when the transaction goes though I get this:;

11-07 23:57:30.825 24424 24424 D IapGooglePlay: billingResponseCodeToDefoldResponse: 0 defoldResponse: 0
11-07 23:57:30.825 24424 24424 D IapGooglePlay: convertPurchase() original json: {"orderId":"GPA.3381-8816-4353-20615","packageName":"com.defold.extension.iap","productId":"com.defold.iap.goldbar.small","purchaseTime":1699397788166,"purchaseState":0,"purchaseToken":"hbalapelmcaccckkiidohkpo.AO-J1OyCmHpgSbma5UVLk27munHw8ERPvjoSwxMs99-S_wpCSs1sQnTBR6rdXud8hUIPCt5z3-owy6WHtyrff66Yac8GK30NdlBW1R3KWYIewMj5nrktvSQ","quantity":1,"acknowledged":false}

I do not see any erros or warnings in logcat during this process. Anything in particular l should look out for?