Meet StoreKit 2

RSS for tag

Discuss the WWDC21 session Meet StoreKit 2.

View Session

Posts under wwdc21-10114 tag

56 results found
Sort by:
Post not yet marked as solved
37 Views

StoreKit 2 currentEntitlements without internet

Hello, I am implementing StoreKit2. My app uses Transaction.currentEntitlements to load the user's purchased subscriptions after the app is launched, how the transactions are loaded? (from the AppStore/Internet or from the local receipt) currentEntitlements doesn't throw any exception, and I'm not sure how to handle the offline case.
Asked Last updated
.
Post not yet marked as solved
1.7k Views

Error thrown when querying for Subscription Products

Hi, I have been testing StoreKit 2. I'm trying to query for available subscription products by using the following query code as per the document. I have configured the in-app purchases with subscriptions in appstoreconnect. The request query keeps throwing an error. Would appreciate some help. Query Code let productIdentifiers: Set = ["monthly_subscription", "yearly_subscription", "family_monthly_subscription", "family_yearly_subscription"]         async {             do {                 let _subscribableProducts = try await Product.request(with: productIdentifiers)                 self.subscribableProducts = _subscribableProducts             }             catch {                 print("Something went wronge \(error)")             }         } Error thrown systemError(Error Domain=ASDErrorDomain Code=507 "Error decoding response" UserInfo={NSLocalizedDescription=Error decoding response, NSLocalizedFailureReason=Could not decode media products response})
Asked Last updated
.
Post not yet marked as solved
272 Views

StoreKit 2 • Purchase Result wrong when Ask to Buy is cancelled (no tap on Ask)

Hello, When 'Ask To Buy' is enabled, and the user cancels the request (left button on the provided screenshot below), the purchaseResult in iOS 15 is set to .pending when we call try await product.purchase(). It's wrong, it should be set to .userCancelled because the parent will never receive any approval request in this case. It breaks the logic in my app because tracking real pending requests is then not possible. I also think that a declined transaction should be made available to the app in the transactions observer: how can we remove a pending transaction that had been declined? We can't for the moment. Thanks, Axel
Asked
by alpennec.
Last updated
.
Post not yet marked as solved
54 Views

StoreKit2 and Apple ID l/p dialog

Hello, I'm using in my app storekit2 solution from wwdc example: https://developer.apple.com/documentation/storekit/in-app_purchase/implementing_a_store_in_your_app_using_the_storekit_api Anyway, I got rejection from Apple with information that "app includes a feature to restore previously purchased in-app purchase products by entering the user's Apple ID and password. However, subscription in-app purchases cannot be restored in this manner." I don't understand this issue. I don't force user to login. What is going on? I don't understand this issue. Can somebody help me understand this? Thanks.
Asked
by pidipius.
Last updated
.
Post not yet marked as solved
864 Views

Is subscription autoRenewStatus in StoreKit2 working correctly with Sandbox testing?

It seems that subscription status gives different results with XCode testing and Sandbox testing. I am using StoreKit2 to implement an IAP of an autorenewable subscription. I want to determine whether the subscription has been cancelled, so that the UI reflects that the subscription will stop after the expiry date and not be renewed. the 'willAutoRenew' property of the subscription status renewalInfo seems to do exactly what is required, and works fine in XCode testing. My setup is very similar to the StoreKit demo associated with the WWDC21 session available here: https://developer.apple.com/documentation/storekit/in-app_purchase/implementing_a_store_in_your_app_using_the_storekit_api/ To demonstrate its use, add: print(renewalInfo.willAutoRenew) after line 79 of the SubscriptionsView in the demo project. When you run the app, and purchase a Standard Navigation assistance subscription, the console shows 'true'. If you then cancel the subscription in XCode (Debug:StoreKit:Manage Transactions), the console will show 'false' as expected So far so good. My problem is that when I move to Sandbox testing, and cancel the subscription in another way (eg using the .manageSubscriptionsSheet view modifier, or in Settings:App Store:Sandbox Account), the willAutoRenew property remains true, even though the subscription is in fact cancelled (ie it disappears after the expiry date) Does anyone know a workaround to determine cancellation status?
Asked
by Baylward.
Last updated
.
Post not yet marked as solved
67 Views

VerificationResult return .verified then My server can deliver content to the user directly?

Use StoreKit 2 my client IAP code like this: func purchase(_ product: Product) async throws -> Transaction? {         let orderId = UUID.init()         let result = try await product.purchase(options: [.appAccountToken(orderId)])         switch result {         case .success(let verification) :             let transaction = try checkVerified(verification) //Here can I tell my server deliver content to user? //I do not want valid transaction on device(just like valid receipt via S2S use Storekit1)             return transaction         case .userCancelled, .pending:             return nil         default:             return nil         }     } If verificationResult return ..verified() case , can I tell my server deliver content to my customer ? Or should I send originalID for this transaction to my server, my server has to fetch transaction info by history Api(decode JWS info) to decide whether to deliver content to my custom? Thank you very much
Asked
by JerryLiu.
Last updated
.
Post not yet marked as solved
305 Views

App Store Promotions - In-App Purchase Warning in App Store Connect

My app uses the new API for in-app purchase rather than the original API as listed here: https://developer.apple.com/documentation/storekit/choosing_a_storekit_api_for_in-app_purchase But in App Store connect I'm getting this error/warning: These in-app purchases can’t be promoted on the App Store because your latest approved binary doesn’t include the SKPaymentTransactionObserver method. SKPaymentTransactionObserver is a part of the old API and I believe I shouldn't need to implement it anymore. Anyone know what I should do here?
Asked Last updated
.
Post not yet marked as solved
315 Views

StoreKit 2 • What is subscriptionGroupID in status(for groupID: String)?

Hello, I want to access the latest transaction for a Subscription Group. I use the following method static func status(for groupID: String) async throws -> [Product.SubscriptionInfo.Status] to access the statuses for the group, and from there, I can get a verified transaction from the status. But when I set the GroupID equal to the Subscription Group Reference Name I put in the .storekit configuration file in Xcode, I don't have any status (so wrong ID). Actually, I have to use a subscriptionGroupID like 3F19ED53 (found using a previous transaction: https://developer.apple.com/documentation/storekit/transaction/3749718-subscriptiongroupid). When I look into a Product, this ID is set for subscriptionFamilyId. So my question is how can I know the ID if it's not the one I provided in App Store Connect or the config file? Do I first have to access a Product from this group? Thanks.
Asked
by alpennec.
Last updated
.
Post marked as solved
94 Views

Is restore button still required if we were using StoreKit2 Transaction.currentEntitlements

Since StoreKit2 Transaction.currentEntitlements will able to return us user current owned purchased, during app startup. If that is the case, is it still necessary for developer to provide a restore button? If we still need to provide a restore button, what should the restore button do and what API should it call? Thanks
Asked
by yccheok.
Last updated
.
Post not yet marked as solved
374 Views

Apple StoreKit Certificate

Where can I download the Apple StoreKit 2 root certificate to install on my NodeJS server to verify StoreKit 2 transactions and make sure the certificate chain in the JWS header comes from Apple?
Asked
by iamlogiq.
Last updated
.
Post not yet marked as solved
146 Views

StoreKit2: does Transaction.all include paid apps?

Hi, I have a paid app available through the Mac App Store, and when the user opens the app, I want to verify that the transaction of the payment is valid. I would have assumed that in StoreKit2, the 'Transaction.all' would work, but when I tested this, it shows 0 transactions for all users. This is what I'm testing: for await result in Transaction.all { guard case .verified(let transaction) = result else { continue } print("verified product = \(transaction.productID)") // send to analytics } But nothing gets observed in the analytics. Does the StoreKit2 framework have an easy way to determine transactions that are made for paid-up-front apps?
Asked
by zulfishah.
Last updated
.
Post not yet marked as solved
342 Views

StoreKit2 to validate purchase of paid-app

Hi, I have a paid app in the Mac App Store, and I want to verify that the user purchased the app legitimately. Does the StoreKit2 framework have an easy way to determine this? From the documentation I've seen, I believe the 'Transaction.currentEntitlements' call will only return transactions for IAP and subscriptions. I would assume that 'Transaction.all' would work, but when I run the app (with Xcode debugger attached) I get no results. What's the best way to test this out for an app that's going to be paid-up-front?
Asked
by zulfishah.
Last updated
.
Post not yet marked as solved
202 Views

App Account Token StoreKit2

Can someone please confirm me how to use App Account Token purchase option? Do we have to save the UUID with the users data or do we not have to do anything? i am really confused in this matter. Any explanation would be extremely appreciated. Thanks 😊
Asked
by MFAB.
Last updated
.