Question on token testing in development:
Hello,
I'm developing a React Native application using StoreKit External Purchase. I'm having difficulties testing the transaction token retrieval in the development environment.
Specific questions:
Is it possible to test the transaction token retrieval in development/sandbox environment?
Is there a special testing mode for developers that would allow simulating token reception without going through the App Store?
Are there specific debugging tools to verify proper token reception?
Question on native implementation:
Regarding the native implementation of StoreKit External Purchase:
Is there detailed documentation on creating native modules for React Native that implement StoreKit External Purchase?
Can you confirm if the following approach is correct for native implementation:
Using NSClassFromString(@"ExternalPurchase")
Calling presentNoticeSheetWithURL:completion:
Retrieving the token in the completion block
Are there any code examples for complete native implementation?
Question on implementation validation:
For validating StoreKit External Purchase implementation:
How can we verify that our implementation is correct before App Store submission?
Are there validation tools or automated tests to check compliance?
What are common errors to avoid during implementation?
Question on best practices:
Regarding implementation best practices:
What's the best way to handle potential errors during token retrieval?
How to handle cases where the user cancels the transaction?
What are the recommended security checks for server-side token validation?
Question on documentation:
I'm looking for additional resources on StoreKit External Purchase:
Is there specific documentation for integration with frameworks like React Native?
Are there complete code examples for native implementation?
Where can I find information about testing and debugging best practices?
Additional technical question:
Technical implementation details:
What's the correct way to handle the ExternalPurchase class initialization in React Native native modules?
Are there specific requirements for the URL passed to presentNoticeSheetWithURL?
How should we handle the token in the completion block to ensure it's properly passed back to React Native?
Question on testing workflow:
Testing workflow questions:
What's the recommended testing workflow for External Purchase implementation?
How can we verify the token format and validity before production deployment?
Are there any tools or methods to simulate the complete purchase flow in development?
StoreKit
RSS for tagSupport in-app purchases and interactions with the App Store using StoreKit.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Our macOS app has one in-app purchase (IAP) implemented using StoreKit 1. It works for us and beta testers but App Review get SKErrorDomain Error Code 0 / ASDErrorDomain Code 500 / AMSErrorDomain 305 on first attempt to make the in-app purchase.
However, the purchase succeeds at second attempt. We've looked through our entire IAP related code and App Store Connect setup but can’t find the reason. It's a standard implementation:
LegacyPaymentQueueObserver for SKPaymentQueue observation.
AppDelegate for initiation of payment queue observation on app launch
LegacyStoreKitPurchasableProduct for initiating a purchase and listening for the result
LegacyStoreKitProductsRequester for how we load the product before user can make in-app purchase. It happens this way:
PreviewResultsViewModelcalls loadProducts()on an instance of StoreKitPurchaseManager, which asks an instance of LegacyStoreKitProductsRequesterto requestProducts(forIdentifiers:)
Any guidance to resolve this would be appreciated.
I am implementing promotional codes for auto-renewing subscriptions in my app. I need to create the codes and have them link to a discounted auto-renewing subscription. So my normal 1 month subscription is $24.99, I would like to offer users (new subscribers and existing/expired subscribers) the ability to enter a promo code that discounts the price of the first month to $4.99, then $24.99 after the initial first month. All users, regardless of whether or not they have has a previous subscription or not should be able to use this code for this discount.
From what I am seeing in documentation, promo codes are only available to users that have had a subscription previously?
Currently I am receiving the response "Offer Not Available" with the error:
<SKPaymentQueue: 0x2815f0d60>: Payment completed with error: Error Domain=ASDServerErrorDomain Code=3904 "Offer Not Available" UserInfo={NSLocalizedDescription=Offer Not Available
I simply do NOT understand why apple engineers have to make something that should be somewhat straightforward, be SO COMPLEX, then when you try to figure out whats going wrong, no meaningful error to troubleshoot. WTF
I have tried this on users that have had a previous subscription and still the same error.
I have a renewing monthly subscription in my app and recently added upgrade possibilities to yearly and 6 month subscriptions. Those new subscriptions were reviewed, approved and published to App Store.
I'm showing a modal for users in the app from where they can upgrade their subscription. Upgrading was tested with real devices on Sandbox and TestFlight. There has been successful purchases through the in app modal in production app, and directly upgrading from App Store.
However, for some users there seems to happen a failed transaction with paymentCancelled error code during the upgrade. The IAP is still successful, their subscription is upgraded and they haven't voluntarily canceled the IAP. The localized description of the error is "Toimintoa ei voitu suorittaa. (Virhe 2 kohteessa SKErrorDomain.)" which translates to "The operation could not be completed. (Error 2 in SKErrorDomain.)"
These users have various iPhones (iPhone 12 Pro, iPhone 14 Pro, iPhone 15 Pro, iPhone 16 Pro) with up to date iOS versions (>= 18.3.1).
I'm receiving DID_CHANGE_RENEWAL_PREF (UPGRADE) server notification of these purchases on my server.
I haven't been able to reproduce this error myself.
Any ideas why StoreKit might fail the transaction with paymentCancelled error but still successfully upgrade the subscription?
Topic:
App & System Services
SubTopic:
StoreKit
We are currently integrating In-App Purchases for our app and have configured App Store Server Notifications (v2) in the Sandbox environment.
During testing, we observed the following issue:
When a transaction is cancelled, declined, or pending (e.g., Ask to Buy flows or authorization pending),
No App Store Server Notification is sent to our webhook endpoint.
We only receive webhook events where the status is "purchased".
This becomes a critical problem for us because our backend must accurately track transaction states including failed and pending purchases, especially for wallet top-up use cases.
Additionally, we tried mocking failed transactions (via Xcode local environment and turning off In-App Purchases from Developer Settings) to simulate a technical failure scenario.
Even in these cases, no webhook notification was received when the purchase failed server-side.
Is it expected behavior in Sandbox that only successful transactions ("purchased") trigger webhooks?
Are failed or pending transactions suppressed in Sandbox intentionally?
Will webhook behavior be different in Production (i.e., will we receive webhook notifications for failures there)?
Is there any extra configuration or entitlement needed to fully test failure scenarios via webhooks in Sandbox?
Topic:
App & System Services
SubTopic:
StoreKit
Tags:
StoreKit
In-App Purchase
App Store Server Notifications
Hi All,
We are developing our app with an approved External Link Account Entitlement.
During the development process (such as installing from Xcode or creating an Ad-hoc build and installing it on a phone), the open() function of the External Link Account API displays the modal our native language. The app only localized to that language.
However, after uploading the app with the same configuration to TestFlight, the modal somehow appears in English instead.
What could be causing this issue with the External Link Account modal? How can the open() function display the modal in another language when installed from Xcode or an Ad-hoc release build, but in English when installed from TestFlight? How can we show only our native lanugage version only to our Users?
Thank you in advance
Is it possible to switch back to V1 if we find some issues? in sandbox and production.
I've found conflicting answers, here is the list of answers and when were they posted:
yes (not sure if only in sandbox mode), dec 2022 -> https://developer.apple.com/forums/thread/722115
no, aug 2024 -> https://forums.developer.apple.com/forums/thread/761272
yes, nov 2024 https://developer.apple.com/documentation/technotes/tn3180-reverting-app-store-server-notifications-v1
What is the right one?
Can we get v2 notifications without enabling it? Just by using this api https://developer.apple.com/documentation/appstoreserverapi/get_notification_history
Thanks for your time
Dear Apple Support,
We are currently in the process of migrating from Apple Server Notifications v1 to v2. As you know, once we switch from v1 to v2 in App Store Connect, this change is irreversible. Our team needs to ensure that our backend environment, developed in Python with Django and using the app-store-server-library==1.5.0, is fully prepared to handle all possible notification types before making that final switch.
While we can receive a basic test notification from Apple, it doesn’t provide the range of data or scenarios (e.g., INITIAL_BUY, RENEWAL, GRACE_PERIOD, etc.) that our code must be able to process, store in our database, and respond to accordingly. Without comprehensive, example-rich raw notification data, we are left guessing the structure and full scope of incoming v2 notifications.
Could you please provide us with a set of raw, fully representative notification payloads for every notification type supported in v2? With these examples, we can simulate the entire lifecycle of subscription events, verify our logic, and confidently complete our migration.
Thank you very much for your assistance.
I’m trying to determine the most appropriate modern method for detecting whether a user originally downloaded a paid app (prior to transitioning the app to freemium/IAP-based access).
Historically, this was done by checking for a valid App Store receipt and using SKReceiptRefreshRequest to ensure a fresh one was available. However, SKReceiptRefreshRequest and many related aspects of StoreKit receipt handling are now deprecated in iOS 17+.
The current Apple documentation on receipt validation still refers to SKReceiptRefreshRequest, which makes things unclear. With so many deprecations and the push toward StoreKit 2, what’s the recommended path to:
Check for a valid App Store receipt
Confirm that the app was originally purchased (as a paid app, not via IAP)
Persist this info to exempt the user from paywalling the app in the future
I don’t need to validate purchases of IAPs — just to detect a legacy paid app download.
Any guidance on best practice for this use case, preferably using non-deprecated APIs (StoreKit 2 or otherwise), would be appreciated.
Topic:
App & System Services
SubTopic:
StoreKit
In the sandbox environment, when I quickly and repeatedly purchase an item, Transaction.id will be repeated.
Will there be duplication in the production environment?
func pay(productId: String, orderId: String) async {
guard !productId.isEmpty, !orderId.isEmpty else { return }
let orderObj = ApplePayOrderModel.init(orderId: orderId, productId: productId)
do {
let result = try await Product.products(for: [productId])
guard let product = result.first else {
return
}
let purchaseResult = try await product.purchase()
switch purchaseResult {
case .success(let verification):
switch verification {
case .verified(let transaction):
orderObj.transactionId = String(transaction.id)
await transaction.finish()
case .unverified(let transaction, let error):
await transaction.finish()
}
case .userCancelled:
break
case .pending:
break
@unknown default:
break
}
} catch {
print("error \(error.localizedDescription)")
}
}
Topic:
App & System Services
SubTopic:
StoreKit
Hi,
We use the (now deprecated) server-side receipt verification API (*1) with the app we are maintaining and there are some points I would like confirm on how its response changes based on whether the purchase being processed was a subscription that used an offer code or not.
I am particularly concerned about the following:
Are there any properties of the response that are added or missing?
Is there any property indicating that an offer code was used?
If there is, which field is that and what values does it take?
Are there any special steps or options required when processing the receipt which used an offer code on the server side?
*1 https://developer.apple.com/documentation/appstorereceipts/verifyreceipt
The app subscription function uses StoreKit. After canceling the subscription, I try to subscribe again and get the following error. I remember it was working fine before iOS 18 was released.
{
NSLocalizedDescription = "\U53d1\U751f\U672a\U77e5\U9519\U8bef";
NSUnderlyingError = "Error Domain=ASDErrorDomain Code=825 "(null)"";
}
Hope you can help me solve this problem as soon as possible. Thanks
I am currently developing an auto-renewal subscription in-app purchase for my app.
Currently, the subscription items have already been approved in appStoreConnect, and the .store file is synced with appStoreConnect, so the subscription items are displayed well and the test is also progressing well.
However, when I build without using the .store file to perform sandbox testing, the subscription items do not appear and response.invalidProductIdentifiers appears.
Is there anything I need to do additionally so that the subscription items can appear in response.products?
ps. The bank account item in the contract is in 'processing' status, and the paid app contract status is 'waiting for user information'.
Issue Description
I am experiencing persistent 401 Unauthorized errors when attempting to access the App Store Server API using JWT authentication. Despite following Apple's documentation and regenerating keys, I am unable to successfully authenticate.
Implementation Details
I'm implementing JWT authentication for the App Store Server API to retrieve transaction information from the following endpoint:
https://api.storekit.itunes.apple.com/inApps/v1/transactions/{transactionID}
My JWT generation code (in PHP/Laravel) follows Apple's documentation:
php$kid = '6W6H649LJ4';
$header = [
"alg" => "ES256",
"kid" => $kid,
"typ" => "JWT"
];
$iss = 'b8d99de7-b43b-4cbb-aada-546ec784e249'; // App Store Connect API Key Issuer ID
$bid = 'com.gitiho.learnCourse'; // Bundle ID
$payload = [
"iss" => $iss,
"iat" => time(),
"exp" => time() + 3600,
"aud" => "appstoreconnect-v1",
"bid" => $bid
];
$pathFileAuthKeyP8 = "AuthKey_6W6H649LJ4.p8";
$contentFileAuthKey = \File::get(base_path($pathFileAuthKeyP8));
$alg = "ES256";
$jwt = \Firebase\JWT\JWT::encode($payload, $contentFileAuthKey, $alg, null, $header);
Steps Taken to Troubleshoot
Verified that the Issuer ID is correct and in UUID format
Confirmed that the Key ID matches the private key filename
Regenerated the key with proper App Store Server API permissions
Ensured the private key file is properly formatted with correct headers and footers
Verified that the JWT is being properly encoded using the ES256 algorithm
Confirmed the bundle ID is correct for our application
Checked that the API endpoint URL is correct
Additional Information
This implementation previously worked correctly
We started experiencing 401 errors recently without changing our implementation
We are using the Firebase JWT library for PHP to encode the JWT
Request
Could you please help identify what might be causing these authentication failures? Is there any recent change in the authentication requirements or endpoint URLs that might be affecting our integration?
Thanks for support me.
I have been receiving beta software from the iPad App Store, despite not being enrolled in a beta program. Additionally, I do not have TestFlight or the Feedback app installed on my device. There are no certificates or profiles displayed either. I am using the App Store app that comes preinstalled on my device (note that I am not located in Europe).
My iPad has been experiencing significant bugs, including numerous screen glitches and periods of sluggishness. Furthermore, numerous applications have crashed frequently. I was able to confirm that I was receiving beta software because the crash reports include beta identifier numbers. According to Apple documentation regarding analytic reports, a beta identifier will only be visible for beta applications.
anyone know what could be going on or how to fix this?
Topic:
App & System Services
SubTopic:
StoreKit
We previously had a non-renewing subscription. I think we remove it. However, the subscription is still listed on the app's page in the App Store. How can I remove this mention?
The availability is still checked for all countries.
Thanks,
Cody.
I try to access the AppDistributor.current (using try await) and the property never seem to return nor throw.
The code I'm using looks like this:
do {
print("accessing current")
let current = try await AppDistributor.current
print("current obtained")
switch(current) {
case .appStore:
return "AppStore"
default:
return "Unknown"
}
} catch {
return "Exception: \(error)"
}
But the log only shows the accessing current and never the current obtained. Trying to step in the property starts with some assembly, but at some point, the debugger just never returned. I join a full Swift file of a sample test I'm using:
SwiftMarketplaceTests.swift
Topic:
App & System Services
SubTopic:
StoreKit
Hi,
I have 6 subscriptions in a subscription group. Each subscription has 2 active promotional offers configured. One is with a 25% offer for a month and another one is a 50% offer for a month.
My doubt is, can users access both promotional offers in a single subscription? Not at a time
First 25% offer and then 50% offer
We are using consumable in-app purchases. Starting from May 27th, we began receiving refund callbacks with the notificationType set to ONE_TIME_CHARGE immediately after users successfully completed a payment.
{
"notificationType": "ONE_TIME_CHARGE",
"signedPayload": "..."
}
During this period, we did not make any changes to our App release or server-side purchase handling logic.
Could this issue result in actual refunds being processed? What steps should we take to resolve this issue?
We also noticed in your changelog that a new notification type ONE_TIME_CHARGE has been introduced.
Can we safely ignore callbacks with the ONE_TIME_CHARGE notification type without affecting refund processing or user experience?
Topic:
App & System Services
SubTopic:
StoreKit
Hi
To test SkAdNetwork, I installed the profile from the documentation (https://developer.apple.com/documentation/storekit/testing-ad-attributions-with-a-downloaded-profile) on my ios device.
and turned off and on Allow Apps to Request to Track to change the idfa value.
In this state, I installed the app (bundle id: id436731843) using SKAdNetwork with the following values at April 8th AM 01 (UTC)
SkAdnetwork version: 3.0
fidelity
fidelity=0, nonce=b3346a51-f7b5-42a2-a508-775a62317c83, timestamp=1744076349671, signature=...
fidelity=1, nonce=b3346a51-f7b5-42a2-a508-775a62317c83, timestamp=1744076349672, signature=...
itunesitem=436731843
network=87u5trcl3r.skadnetwork
sourceapp=1220307907
I was hoping to get a postback after , but after a day, the postback is still not delivered.
Any idea why the postback is not delivered?
Thank you
Topic:
App & System Services
SubTopic:
StoreKit