# Failed Apple IAP Receipt Validation

**URL:** <https://forum.heroiclabs.com/t/failed-apple-iap-receipt-validation/3488>\
**Category:** Runtime Framework\
**Tags:** server-framework, golang\
**Created:** [February 4, 2023, 6:26pm UTC](https://forum.heroiclabs.com/t/failed-apple-iap-receipt-validation/3488 "2023-02-04T18:26:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BergerBytes](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/bergerbytes/32/1877_2.png) [@BergerBytes](https://forum.heroiclabs.com/u/BergerBytes)\
**Post date:** [February 4, 2023, 6:26pm UTC](https://forum.heroiclabs.com/t/failed-apple-iap-receipt-validation/3488/1 "2023-02-04T18:26:12Z")

</div>

When validating sandbox receipts, I receive a strange error that doesn’t give me much to go on. Validating the receipt locally works. I can provide the receipt and shared secret if needed.

I have tried completely deleting the database and starting fresh, but I still get the same error.

1. Versions: Nakama v3.15.0, Docker, REST
2. Server Framework Runtime language: Go

```plaintext
REST Endpoint: "v2/iap/purchase/apple"

Response: NakamaError(code: 2, message: "ERROR: syntax error at or near \"$8\" (SQLSTATE 42601)")

```

Just looking for any input on what I am possibly doing wrong; thanks!

EDIT: It looks like it’s an error thrown from the database:

```plaintext
2023-02-04 19:59:20.133 UTC [66] ERROR: syntax error at or near "$8" at character 274
2023-02-04 19:59:20.133 UTC [66] STATEMENT:  
        INSERT
        INTO
            purchase
                (
                    user_id,
                    store,
                    transaction_id,
                    product_id,
                    purchase_time,
                    raw_response,
                    environment,
                                                        refund_time
                )
        VALUES
            ($1, $2, $3, $4, $5, $6, $7 $8), ($9, $10, $11, $12, $13, $14, $15 $16), ($17, $18, $19, $20, $21, $22, $23 $24)
        ON CONFLICT
            (transaction_id)
        DO UPDATE SET
            refund_time = $8, update_time = now()
        RETURNING
            transaction_id, create_time, update_time, refund_time

```

---

<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:** [February 4, 2023, 10:50pm UTC](https://forum.heroiclabs.com/t/failed-apple-iap-receipt-validation/3488/2 "2023-02-04T22:50:03Z")

</div>

Hello @BergerBytes, please see: [Getting SQL Error on Google Receipt Validation persist=true - #2 by mharis](https://forum.heroiclabs.com/t/getting-sql-error-on-google-receipt-validation-persist-true/3453/2)

---

<div class="post-metadata">

**Author:** ![BergerBytes](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/bergerbytes/32/1877_2.png) [@BergerBytes](https://forum.heroiclabs.com/u/BergerBytes)\
**Post date:** [February 4, 2023, 10:51pm UTC](https://forum.heroiclabs.com/t/failed-apple-iap-receipt-validation/3488/3 "2023-02-04T22:51:05Z")

</div>

Ah, I missed that post. I only searched for Apple. Thank you!
