# IAP block update \[June 8 2022\]

**URL:** <https://community.thunkable.com/t/iap-block-update-june-8-2022/1919447>\
**Category:** In App Purchase\
**Created:** [June 10, 2022, 11:50am UTC](https://community.thunkable.com/t/iap-block-update-june-8-2022/1919447 "2022-06-10T11:50:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [June 10, 2022, 11:50am UTC](https://community.thunkable.com/t/iap-block-update-june-8-2022/1919447/1 "2022-06-10T11:50:15Z")

</div>

In an effort to ensure all apps are running as expected, please take note of. these updates to the IAP blocks. Specifically regarding how the purchaseObject information is passed in the Green block in the improvements below. If you do not align your project with the indicated change **and** push an update after today [June 8 2022] your IAP workflows will not execute as expected.

# Bug Fixes

- “then do” section of blocks is not firing  
– fixed

# Improvements

- true/false socket on the one-time purchase block for android purchases
- **green `purchase` block previously returned a list like this**

```auto
"originalOrderId": "",
"acknowledged": false,
"productId": "consumeable",
"transactionReceipt": "LongString", (iOS only)//this is the value you pass to your verification call
"transactionID": "shortString", (
"purchaseState": 1,
"orderId": "2000000003481980", //this is a value you can use to store transaction data, for example in the realtime database
"originalPurchaseTime": 0,
"purchaseTime": 1646316547000 //this should not be used to calculate a date at which a subscription expires. you should do that through the verification calls. 
}]

now the block return only a single item like this
{
"originalOrderId": "",
"acknowledged": false,
"productId": "consumeable",
"transactionReceipt": "LongString", (iOS only)//this is the value you pass to your verification call
"transactionID": "shortString", (
"purchaseState": 1,
"orderId": "2000000003481980", //this is a value you can use to store transaction data, for example in the realtime database
"originalPurchaseTime": 0,
"purchaseTime": 1646316547000 //this should not be used to calculate a date at which a subscription expires. you should do that through the verification calls. 
}

```

a subtle but breaking change.

# you need to update your logic such that you don’t request an item from a list but just use the purchaseObject passed by the block

https://www.loom.com/embed/a4c450235912459b8dbb6634aa26d452

```auto

```

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [June 10, 2022, 6:30pm UTC](https://community.thunkable.com/t/iap-block-update-june-8-2022/1919447/2 "2022-06-10T18:30:30Z")

</div>

A Missed Update:

# All Android purchases AND subscriptions are automatically acknowledged for you!

---

<div class="post-metadata">

**Author:** ![hhuman](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@hhuman](https://community.thunkable.com/u/hhuman)\
**Post date:** [June 28, 2022, 3:57am UTC](https://community.thunkable.com/t/iap-block-update-june-8-2022/1919447/3 "2022-06-28T03:57:19Z")

</div>

What do you mean that Android purchases and subscriptions are automatically acknowledged? Do we no longer need to include the blocks for acknowledging Android purchases and subscriptions?

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [June 28, 2022, 12:59pm UTC](https://community.thunkable.com/t/iap-block-update-june-8-2022/1919447/4 "2022-06-28T12:59:56Z")

</div>

Great question!

You **don’t** need to acknowledge android purchases anymore! You should always be prepared to verify that a purchase is still valid for ongoing purposes. For example, during a subscription, you may want to verify that it’s still valid once a week or bi-monthly. You don’t _ **have to do this** _ but it’s recommended.

I manage all of my purchases on Xano now, so I do a simple API call to the backend, it does it’s magic, then returns a list of valid non-consumable purchases, remaining consumables, and valid subscriptions.

---

<div class="post-metadata">

**Author:** ![hhuman](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@hhuman](https://community.thunkable.com/u/hhuman)\
**Post date:** [June 28, 2022, 4:23pm UTC](https://community.thunkable.com/t/iap-block-update-june-8-2022/1919447/5 "2022-06-28T16:23:21Z")

</div>

That’s good news! Just to be clear before I delete the wrong blocks, do I remove #1 and #2 in the image below from your old documentation examples? And only the group of blocks in #3 is really needed now?

 ![Screenshot](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/0/a00911e9be3c4c47aea10182ca4e60c0ec045b3a.jpeg)

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [June 28, 2022, 4:45pm UTC](https://community.thunkable.com/t/iap-block-update-june-8-2022/1919447/6 "2022-06-28T16:45:00Z")

</div>

THat’s a great question. You can remove everything in step 2 i believe.

you should save the purchase to the user. this requires having a table of rows/bucket of objects of user data like this

 ![Screen Shot 2022-06-28 at 12.42.45 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/a/1a9a2bfa174b8cbd6664d1f62431cc2912209773.png)

and probably maintain a table of purchases as also like this

 ![Screen Shot 2022-06-28 at 12.43.00 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/b/db62a83098f12e806a3774b2cfd703194ac251c0.png)

doing so allows you to quickly query what a users current/active purchase information. as well as provide them and yourself with purchase histories. makes restoring purchases a breeze! this way you only query your table and restore the purchases.

then you can use the endpoint found. [here](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.voidedpurchases/list) to regularly check for voided/refunded purchases and update the users entry in your users table if/when needed.

you can check a subscription. directly using the endpoint found [here](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions) but purchases cannot be checked in the same fashion. you must query each purchase individually for the user. having a table will all their purchases allows you to query the table for the users purchases and then loop over those purchases to verify they are still active.

---

<div class="post-metadata">

**Author:** ![hhuman](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@hhuman](https://community.thunkable.com/u/hhuman)\
**Post date:** [June 29, 2022, 5:03pm UTC](https://community.thunkable.com/t/iap-block-update-june-8-2022/1919447/7 "2022-06-29T17:03:51Z")

</div>

This is good info, Jared. Thank you for sharing this method. I am being stretched out of my longtime comfort zone inside Realtime db. What are you using in the screenshots above? Is that airtable?

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [June 29, 2022, 7:40pm UTC](https://community.thunkable.com/t/iap-block-update-june-8-2022/1919447/8 "2022-06-29T19:40:26Z")

</div>

> [@hhuman](#):
>
> nside Realtime db. What are you using in the screenshots above? Is that airtable?

Xano 🙂 BUT you could accomplish the same in firebase

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:13pm UTC](https://community.thunkable.com/t/iap-block-update-june-8-2022/1919447/9 "2024-11-08T13:13:11Z")

</div>


