2

I have started using the new StoreKit2 APIs. I wanted to know if there is a way to see if a product is still pending after the app is relaunched.

In the new APIs, a purchase is executed by calling purchase() on a Product"

let result = try await product.purchase()

In the result one gets a set of values through which one can see if the item was paid for, or payment is still pending.

When restarting, one can call Transaction.currentEntitlements which checks if the product was purchased. However, I want to be able to show the user if the transaction has not as yet been completed for them to see that it is still pending.

Is there anyway to get that information for a product?

Thanks
Reza

reza23
  • 3,079
  • 2
  • 27
  • 42
  • I have the same question as you. Did you manage to find an answer? – DaleOne May 18 '22 at 17:28
  • 1
    I did not find anything with StoreKit. I decided to store my own variable to monitor this. – reza23 May 19 '22 at 21:53
  • https://developer.apple.com/documentation/storekit/product/purchaseresult/pending – Alexander Yakovlev Jan 31 '23 at 13:14
  • The easiest solution is to create an array of all products and then a second array for pending purchases. While your app runs, it will receive updates in Transaction.updates or current entitlements where you can drop the array element in pendingProductsArray. reza23 said the same. – Darkwonder Jul 14 '23 at 04:59

0 Answers0