Post not yet marked as solved
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.
Post not yet marked as solved
SKProductsRequest always returns as USD not local currency for debug environment and even some time it fails. This is only happening for debug or TestFlight build.
Post not yet marked as solved
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.
Post not yet marked as solved
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
Post not yet marked as solved
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
Post not yet marked as solved
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?
Post not yet marked as solved
How is the app informed that the status of a subscription has changed?
Post not yet marked as solved
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 😊
Post not yet marked as solved
Hello everyone,
I'm trying to use Storekit 2 for my application. But I have an issue when checking the expired date.
I cancelled the subscription in the setting (Sandbox). After few minutes, the subscription was expired (stop to renew). It's OK.
But after I open my app, the status of the subscription still "Subscribed" although the expiredDate was expired. Why the status wouldn't be "Expired"?
func updateSubscriptionStatus() async {
do {
guard let product = subscriptions.first,
let statuses = try await product.subscription?.status else {
return
}
for status in statuses {
switch status.state {
case .subscribed:
print("Always enter this case with expired date.")
case .expired:
print("Never enter this case.")
case .revoked:
break
case .inGracePeriod:
break
case .inBillingRetryPeriod:
break
default:
break
}
}
} catch {
}
}
Post not yet marked as solved
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?
Post not yet marked as solved
Hi,
I have a look to wait for all non purchase Transaction
for await result in Transaction.updates {
…
}
But this block works when I trigger a restore purchases, but it is never called when I approve a pending purchase.
Is there any reasoning why this could be or a bug. (As an app store user and father I had a similar problem where my daughter had to tap purchase again and then it worked.
All the best
Christoph
Post not yet marked as solved
I am using Storekit 2 for in-App Purchase, I am having problem regarding with manage subscriptions UI, when I click on manage subscriptions custom button then Manage subscriptions apple UI open and when I click on cross button , it does not remove on iPhone 13 and on the other hand on other iPhone XR the Subscription window is hide but app got stuck with black window
Post not yet marked as solved
Does anyone know what the StoreKit2 equivalent to original StoreKit's SKPaymentQueue.presentCodeRedemptionSheet() is?
I'm not seeing anything in the docs that appears to handle Offer Codes specifically. Yes, there's
static func promotionalOffer(offerID: String, keyID: String, nonce: UUID, signature: Data, timestamp: Int) -> Product.PurchaseOption
but promotional offers are a separate thing to Offer codes, I believe.
Appreciate any pointers anyone has on how to allow in-app redemption of an Offer Code using StoreKit2.
I'm assuming I should not include original StoreKit as well as StoreKit2 and call the older API, right?
Post not yet marked as solved
if let status = try await product.subscription?.status {
for state in status {
if (state.state == .subscribed) {
isPro = true
break
}
}
}
When I subscribe with the api product.purchase in my app, every thing work right. The state is updated to .subscribed right after the purchase finished. However, when I manage the subscription in App Store sandbox with a test account. The subscription state does not updated until I manually ask for another purchase in my app. Then a window popup telling me that I have already purchased this product. And then the state of the subscription also updated to .subscribed.
I have also made a update listener to listener all transaction update, just like how SKDemo do. But seems it doesn't receive any update.
Last, could any one tell me that if the update listener also responsible for listening the expiration of a subscription?
Post not yet marked as solved
I am building a app which only support iOS version over 15.0 and using storekit2 to make in app purchase. I read that by using storekit2 developer no longer need to restore purchase info manually. I wonder if I could dismiss a restore button in my app
Post not yet marked as solved
When we request the current entitlements for a user using the Transaction.currentEntitlements static method, does StoreKit provide transactions for subscriptions with a Product.SubscriptionInfo.RenewalState set to .inGracePeriod or only .subscribed?
I'm asking because as a developer we need to give access to content to a user if its subscription is in .inGracePeriod. So in my opinion, the user is still entitled to this subscription.
I've not found any information in the documentation, WWDC videos or Apple sample codes. The documentation explains
The latest transaction for each active auto-renewable subscription
Is .inGracePeriod considered an active subscription?
Post not yet marked as solved
When dealing with auto-renewable subscriptions, there are multiple ways to access the latest transaction. We can access it when a purchase is made, or we can request the latest transaction for a given productID at a later time. To do so, we can use Transaction.latest(for:), access the transaction history using Transaction.all, get the currentEntitlements, or use the array of Product.SubscriptionInfo.Statusthan contains the latest transaction for a subscription group. It's also necessary to listen to transactions when the app is running using the AsyncSequenceTransaction.updates`.
In my app (and also in the SKDemo project from Apple), when I want to access the latest transaction as soon as the app is launched, it's missing the transactions that renewed or happened while the app was not running. I tried using the different methods mentioned above but they never give me the latest transaction, always the latest transaction while the app was running before I killed it. I have to wait for a new renewal event to receive the latest transaction in the Transaction.updates listener, which is not good. For example, when I set the Subscription Renewal Rate to Monthly Renewal Every 30 seconds, and I quit the app when the latest transactionId is 100, I wait for 5 minutes, I expect to see the transactionId 110 but I see 100. In the real life, it means that if the app is not running when a monthly or annual subscription renews, I have to wait weeks or months to receive the missing transaction. I thought that the Transaction.updates listener would be called at launch with all the transactions that occurred while the app was not running.
Is that a bug in Xcode or have I misunderstood something? How can I access the real latest transaction that happened when the app was not running at launch? I need to access that to know what the user has access to. I think the transaction management panel from Xcode displays all the transactions, even the one when the app was not running.
PS: I'm using Xcode 13.2.1 and iOS 15.0 (simulator). Transaction.updates is not working on iOS 15.2 (my device, or simulator) from what I've seen so far.
I used StoreKit 2 to implement in-app purchases (maybe it was a wrong choice). It performed perfectly during the development and testing phases, but when I submitted the App for review, the products could not be loaded.
I checked the configuration and code many times, and used TestFlight to test on multiple devices, but the problem was not reproduced.
It is now suspected to be a problem with the StoreKit 2 and App Review environment.
I submitted a feedback using Feedback Assistant: FB9809466.
Now, I don’t know what I should continue to do to help myself solve the current dilemma.
Maybe I should use the old version of StoreKit to refactor everything?
Post not yet marked as solved
The response body for the body for the app store server notification responseBodyV2 on sandbox returns same originalTransactionId for different subscription product ids when decoded
Post not yet marked as solved
I'm not a member of any Family in iCloud. I want to understand what happens when a user is subscribed through Family Sharing but also how to use StoreKit when the user is subscribed twice: as an individual who purchased the product and as a member of a family when the purchase is shared with him.
How can I test Family Sharing for an app offering a product with Family Sharing enabled? Is it possible to create a fake Family in App Store Connect and add testers to it?