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

**URL:** <https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474>\
**Category:** Bugs\
**Created:** [August 22, 2022, 2:11am UTC](https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474 "2022-08-22T02:11:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![RedHunter7](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/redhunter7/32/26101_2.png) [@RedHunter7](https://forum.defold.com/u/RedHunter7)\
**Post date:** [August 22, 2022, 2:11am UTC](https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474/1 "2022-08-22T02:11:07Z")

</div>

**Bug Description**

 ![iap payment](https://forum-defold.b-cdn.net/uploads/default/original/3X/4/3/433f4cad3e5c6def55417adffae8341f9fc17c3c.png)

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 the pending transaction is fail/error.

I use this listener code for testing Google play IAP Billing :

```lua
local function buy_listener(self, transaction, error)
	pprint(transaction)

	if error == nil then
		if transaction.state == iap.TRANS_STATE_PURCHASING then
			print("Purchasing...")
		elseif transaction.state == iap.TRANS_STATE_PURCHASED then
			print("Purchased!")
			print("transaction id : " .. transaction.ident)
		elseif transaction.state == iap.TRANS_STATE_UNVERIFIED then
			print("Unverified!")
		elseif transaction.state == iap.TRANS_STATE_FAILED then
			print("Failed!")
		elseif transaction.state == iap.TRANS_STATE_RESTORED then
			print("Restored")
		end
	elseif error then
		print(error.error)

		if error.reason == iap.REASON_USER_CANCELED then
			print("Reason User Canceled")
		elseif error.reason == iap.REASON_UNSPECIFIED then
			print("Reason Unspecified")
		end
	end
end

```

**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`

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [August 22, 2022, 4:50am UTC](https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474/2 "2022-08-22T04:50:01Z")

</div>

Thank you for reporting this! I was not aware of slow test cards. How do you use them?

Could you please create a ticket in the extension-iap repository on GitHub so that we can start an investigation?

---

<div class="post-metadata">

**Author:** ![RedHunter7](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/redhunter7/32/26101_2.png) [@RedHunter7](https://forum.defold.com/u/RedHunter7)\
**Post date:** [August 22, 2022, 7:34am UTC](https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474/3 "2022-08-22T07:34:54Z")

</div>

[https://github.com/defold/extension-iap/issues/50](https://github.com/defold/extension-iap/issues/50)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [August 22, 2022, 10:19am UTC](https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474/4 "2022-08-22T10:19:16Z")

</div>

That’s great. Thank you.

---

<div class="post-metadata">

**Author:** ![RedHunter7](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/redhunter7/32/26101_2.png) [@RedHunter7](https://forum.defold.com/u/RedHunter7)\
**Post date:** [September 14, 2022, 5:28pm UTC](https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474/5 "2022-09-14T17:28:12Z")

</div>

I still encounter the same issue when using the newest version of IAP extension.

here is my logcat when purchase testing google play products using the “Slow test card, approves after few minutes” method :

 ![Screenshot_2022-09-15_00-05-23](https://forum-defold.b-cdn.net/uploads/default/original/3X/e/5/e554484247a45da3470778a53245afbacb31b318.png)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [September 14, 2022, 9:02pm UTC](https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474/6 "2022-09-14T21:02:32Z")

</div>

> [@RedHunter7](#):
>
> I still encounter the same issue when using the newest version of IAP extension.
> 
> here is my logcat when purchase testing google play products using the “Slow test card, approves after few minutes” method

Hmm, ok, I was not able to reproduce this. Which Android OS version are you testing on?

---

<div class="post-metadata">

**Author:** ![RedHunter7](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/redhunter7/32/26101_2.png) [@RedHunter7](https://forum.defold.com/u/RedHunter7)\
**Post date:** [September 15, 2022, 6:32am UTC](https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474/7 "2022-09-15T06:32:22Z")

</div>

> [@britzl](#):
>
> Hmm, ok, I was not able to reproduce this. Which Android OS version are you testing on?

Samsung A32 (Android 12) & Google Pixel 4 (Android 11)

---

<div class="post-metadata">

**Author:** ![AarrrBee](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/aarrrbee/32/24978_2.png) [@AarrrBee](https://forum.defold.com/u/AarrrBee)\
**Post date:** [September 15, 2023, 2:40pm UTC](https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474/8 "2023-09-15T14:40:47Z")

</div>

We’re seeing this [same](https://github.com/defold/extension-iap/issues/50) issue:

```
 ERROR:IAPEXT: IAP error 5
09-15 14:19:39.468 21314 21545 D defold : DEBUG:SCRIPT: IAP Error
09-15 14:19:39.468 21314 21545 D defold : DEBUG:SCRIPT: {
09-15 14:19:39.468 21314 21545 D defold : error = "failed to buy product",
09-15 14:19:39.468 21314 21545 D defold : reason = 0
09-15 14:19:39.468 21314 21545 D defold : }

```

and suspect it’s causing problems for real-life users.  
I’d be really curious to know if anyone is using defold-iap in a published Android game?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [September 15, 2023, 9:20pm UTC](https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474/9 "2023-09-15T21:20:27Z")

</div>

> [@AarrrBee](#):
>
> I’d be really curious to know if anyone is using defold-iap in a published Android game?

I am almost 100% certain that Melsoft is using it in Family Island. Perhaps @Insality can confirm?

---

<div class="post-metadata">

**Author:** ![SkaterDad](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/skaterdad/32/41137_2.png) [@SkaterDad](https://forum.defold.com/u/SkaterDad)\
**Post date:** [September 16, 2023, 4:20am UTC](https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474/10 "2023-09-16T04:20:59Z")

</div>

Does this show up in the Play Console?

I used the extension with Apple Spider, and always saw a lot of “Payment declined” from certain countries.

Don’t do any logging in production, so not sure if it’s related.

---

<div class="post-metadata">

**Author:** ![Shocopop](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/shocopop/32/34166_2.png) [@Shocopop](https://forum.defold.com/u/Shocopop)\
**Post date:** [November 9, 2025, 6:22pm UTC](https://forum.defold.com/t/issue-when-purchase-testing-android-iap-product-using-slow-test-card-method/71474/11 "2025-11-09T18:22:46Z")

</div>

If someone is having the same issue, you are probably using `iap.finish()` or `iap.acknowledge()` while you also have `auto_finish_transactions` set to `true` in the game.project

In that case, you are tyring to finish the purchase twice. Once `auto_finish_transactions` is set to `false` you should not see the error anymore.
