# Unity IAP Validate Typescript Runtime doc missing

**URL:** <https://forum.heroiclabs.com/t/unity-iap-validate-typescript-runtime-doc-missing/5620>\
**Category:** Runtime Framework\
**Tags:** server-framework, typescript\
**Created:** [September 10, 2024, 11:28am UTC](https://forum.heroiclabs.com/t/unity-iap-validate-typescript-runtime-doc-missing/5620 "2024-09-10T11:28:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mengxin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mengxin/32/1879_2.png) [@mengxin](https://forum.heroiclabs.com/u/mengxin)\
**Post date:** [September 10, 2024, 11:28am UTC](https://forum.heroiclabs.com/t/unity-iap-validate-typescript-runtime-doc-missing/5620/1 "2024-09-10T11:28:15Z")

</div>

we want to validate the Unity IAP, we can see the doc have Go runtime code, but no Typescript. we can find the corresponding API for validate, but cannot find any doc for the error handle

> **[In-app Purchase Validation](https://heroiclabs.com/docs/nakama/concepts/iap-validation/#unity-iap)**
>
> In-App purchases enable purchases for unlocks, in-game consumables, subscriptions, and more. Purchases must be validated to maintain integrity and security in the player experience. Nakama supports single product and subscription purchase validation...

for example, what corresponding code in TS for this part of code?

```auto
if err != nil {
        if err == runtime.ErrPurchaseReceiptAlreadySeen {
            logger.WithField("err", err).Warn("Receipt replay attack.")
        } else {
            logger.WithField("err", err).Error("Receipt validation error.")
        }
        return ErrBadInput
}

```

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [September 10, 2024, 3:37pm UTC](https://forum.heroiclabs.com/t/unity-iap-validate-typescript-runtime-doc-missing/5620/2 "2024-09-10T15:37:42Z")

</div>

Hello @mengxin,

The docs are outdated, we’ve taken note to update them - if the receipt has already been used, the validation APIs won’t return an error, but instead will have a property `seenBefore` in the validated receipt set to true ([nakama-common/index.d.ts at master · heroiclabs/nakama-common · GitHub](https://github.com/heroiclabs/nakama-common/blob/master/index.d.ts#L3189)).

You should inspect that property and log (and potentially surface an error) if the value is `true`.

Hope this clarifies.
