I am using the recommended method of confirming IAP receipts. The client tries to purchase, sends the receipt data to our game server (along with the StoreKitTransaction.productIdentifier and transactionIdentifier), our server verifies the receipt with Apple’s server and then our server verifies several things:
- Purchase hasn’t been used before (isn’t in our db)
- Purchase is for THIS app (by verifying both the bid and product_id)
- transactionIdentifier client sends up from StoreKitTransaction is compared to transaction_id found in Apples receipt
About 95% of our purchases succeed. However, I’ve had two users whose transactions fail test 3. The StoreKitTransaction.transactionIdentifier the client sends to our game server is different from the transaction_id Apple’s receipt contains.
Example of GOOD transaction:
Client sends to our server: transId:14021391238918, prodId:“500 coins”
Our server gets from Apple’s server: transId:14021391238918, prodId:“500 coins”
Example of BAD transaction:
Client sends to our server: transId:CD9B55238-3C81-42B7-8TTW-62391FBDLQO6B, prodId:“500 coins”
Our server gets from Apple’s server: transId:128391278321, prodId:“500 coins”
ALL of our successful transactionIds are 16 integers like in the good example above. ALL of the failed transactionIds are those big number/letter combos.
Any ideas? Thanks!
Possible interesting sidenote: The format for the failed transactionIds matches up exactly with the “unique_vendor_identifier” field of Apple’s receipts.
TLDR: We sometimes experience: transactionId from client doesn’t match tansactionId from Apple’s receipt when validating from a server.
yeah, it's super-common .. indeed it's universal. it's actually really, really hard to do IAP and so on, really securely. What a hassle! Note that in the real world you really have to make your server track all transactions, and only ever approve a transaction to your app ONCE. it's sort of the "elephant in the room" or the "dirty little secret" of doing IAP.
– FattieYa - it's crazy how common it is. I'm just glad the system we put in place seems to be secure. We track all the transactions like you said and make sure they only occur once. Thanks for marking it as the answer.
– blindgoat"We track all the transactions and make sure they only occur once" You nailed it. Like I say, it's totally weird that you never hear people mentioning that. Like it's an absolute basic in the app store. Just one of those weird things in life !
– FattieHi Blindgoat and co I'm curious as to HOW you track the transactions? Do you save the original transaction number or the product id number? Thanks.
– StoneFishHi Blindgoat et al... I'm curious as to HOW you track the transactions? Do you save the original transaction number or the product id number? Thanks.
– StoneFish