I’m trying to validate Purchase Apple
nakama.purchaseValidateApple
(
player.userId
,
receiptPayload
,
true
);
here receiptpaylad have old transaction too how i get the latest since it give always seen before true.
so how handle this situation
i using typescript with FROM registry.heroiclabs.com/heroiclabs/nakama:3.27.1
You’d have to sort the returned validated purchases by `purchaseTime`, or lookup the specific purchase you’re looking for based on its metadata.
Thanks for your reply, but when I purchased an iap, it saved all previous transactions
const sortedPurchases = purchaseIapValidation.validatedPurchases.sort((a: nkruntime.ValidatedPurchase, b: nkruntime.ValidatedPurchase) => b.purchaseTime - a.purchaseTime);
const latestUnseenPurchase = sortedPurchases.find((p) => !p.seenBefore);
This is solution for some time, but sometimes error occurs.