In-App Purchase

RSS for tag

Offer extra content, digital goods, and features directly within your app using in-app purchases.

Posts under In-App Purchase tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Inquiries about API SERVER Notification
Inquire the types of notifications that can occur in a SANDBOX environment Hello, WWDC 2024 is trying to conduct a test to receive notifications related to ONE_TIME_CHARGE, CONNSUMPTION_REQUEST, CONMSUMPTION_INFO, REFUND, and REFUND_DECLINED as described in the example of purchasing consumables, but as a result of the continuous search, I found that it is difficult to occur except for ONE_TIME_CHARGE. So, in order to verify only the business logic as shown below, we are testing only the business logic without actually calling the API after purchasing the test and saving the signaled Payload that we received in response to ONE_TIME_CHARGE. Can we actually request a refund for the test purchase and receive the corresponding notification and actually send the response? public void handleSignedNotification(String signedNotification) throws Exception { ResponseBodyV2DecodedPayload payload = signedDataVerifier.verifyAndDecodeNotification(signedNotification); NotificationTypeV2 type = payload.getNotificationType(); //For Apple Server Notification, only ONE_TIME_CHARGE notifications are enabled in the test environment, so for testing, change them as below to test whether they are running business logic type = NotificationTypeV2.REFUND; log.info("Apple NotificationType : {}", type); switch (type) { case CONSUMPTION_REQUEST: handleConsumptionRequest(payload); break; case REFUND: handleRefund(payload); break; case REFUND_DECLINED: handleRefundDeclined(payload); break; // For other necessary notifications, just take a log default: log.info("Unhandled notification: {}", type); } } Regarding the call of 'CONSUMPTION_INFO', which is the response of 'CONSUMPTION_REQUEST' Is there a value that WWDC 2024 must include when sending CONMSUMPTION_INFO, which is the response to CONNSUMPTION_REQUEST described in the refund example? I'm going to call the API with only sample provision and consumption like the sample code you introduced in the video. I was told to submit my refund preference within 12 hours, but can I submit it as UNDECLARED at first and use the method to express my intention? When I receive the notification, I will save it in the DB and save it in the administrator page of the service so that the administrator can choose. 2-1. Some of the materials I looked for are told that Apple can proceed with the refund even 12 hours ago, and to express your opinion as soon as I receive the notification, but I wonder if this is correct. If you get a notification as below, you should write whether you used it or not by referring to the consumption information. I think the customer said to check whether the data was provided when applying for a refund. Should I take it out of decodedTransaction, check the value, and just call it NO_PREFERENCE? I'd appreciate it if you could give me some advice. Below is a part of the code I implemented. private void handleConsumptionRequest(ResponseBodyV2DecodedPayload notification) throws Exception { // 1. transaction ID get String signedTransactionInfo = notification.getData().getSignedTransactionInfo(); JWSTransactionDecodedPayload decodedTransaction = signedDataVerifier.verifyAndDecodeTransaction(signedTransactionInfo); String transactionId = decodedTransaction.getTransactionId(); // 2. Extract the relevant transaction (The following example is an in-app payment and will be accumulated in two types of DBs, stored in one of the two) Sample sample = sampleService.findByAppleTransactionId(transactionId); Example example = exampleService.findByAppleTransactionId(transactionId); Boolean canRefund = false; // 3. Check consumption information if (sample != null) { canRefund = checkSampleStatusForApplePurchaseRefund(sample); } else if (example != null) { canRefund = checkExampleStatusForApplePurchaseRefund(example); } // 4. Create Refund Preferences RefundPreference refundPreference = determineRefundPreference(canRefund); // 5. Creating a ConsumptionRequest Object ConsumptionRequest request = new ConsumptionRequest() .refundPreference(refundPreference) .sampleContentProvided(true); log.info("forTest~ canRefund: {}", canRefund); log.info("forTest~ sample: {}", sample.toString()); log.info("forTest~ example: {}", example.toString()); log.info("forTest~ refundPreference: {}", refundPreference); log.info("forTest~ request: {}", request); // 6. Transfer to App Store (annotated with dummy requests that only confirm current business requests are going right) // appStoreServerAPIClient.sendConsumptionData(transactionId, request); }
0
0
195
Feb ’25
IAP setup for Multiplatform: Free trial and lite version with sub and non sub
Hi, how would we setup our IAP for our usecase: Our product is to be Multiplatform: iOS, Android, Windows, Website. Our users are world over so our website will have multi-payment methods. We want to offer, by default, a 100% free Full version of our app to all users when they signup (on any platform and it should port over to any other platform with the same plans/duration too. Not that they signup on our website today and get 6 moths free then after 1 month login to iOS app with same email and have to re-start a new 6 month trial. Expect on iOS now it shows 5 months left, or vise versa too). After 6 months we revert their account to a lite version which has limited features (ex: In full version send unlimited messages, and in lite send messages to 10 people per week). If they choose they want the full features again, then they can subscribe to yearly plans or buy a long 5 year 1 time plan then again revert to lite after 5 years. Otherwise they can continue using the lite version forever. And again, if they subscribe to a sub or non sub plan on any platform, it should all port over to iOS too, or any plan changes made on iOS should port to the web/windows and android too. So: What is the setup required app store connect side/iOS app side to pass the IAP app store review for my use case?
0
0
197
Jan ’25
Does the tier-0 in app purchase still exist?
Hi, I am looking for a way to implement X-day free trial and then the feature would be locked. User should purchase the in app purchase to unlock the feature after trial period if they wish to continue to use it. From the older post, I can see other people suggest non-consumable tier-0 IAP will should cost nothing. From app store connect, I am not able to find 0 dollar as an option. I can see in apple's storekit documentation. There are officially a free trial subscription. I don't believe this can fit in my use case. Is anyone still able to create free in app purchase ?
0
0
204
Jan ’25
Subscription Paywall Stuck on 'Loading Subscription': Works in Debug, Stuck in TestFlight/Production
Fellow Developers, I'm encountering a strange issue with subscriptions. My paywall properly fetches the products in debug mode when my device is connected to Xcode using a StoreKit Configuration file synced to the app in App Store Connect. However, when I test the app on TestFlight or in production, the paywall only shows "Loading Subscription." I use the SwiftUI: SubscriptionStoreView(productIDs: subscriptionsManager.products.map { $0.id }) { // Subscription paywall content here } Since it works flawlessly with the StoreKit Configuration file in debug mode, I believe I can rule out issues with my SubscriptionManager logic or naming typos. Subscriptions are approved in App Store Connect. What could I be missing here? Thank you!
2
0
224
Jan ’25
Seeking Clarification on Guideline 3.1.3(c) - Enterprise Services and In-App Purchases
Hello everyone, I’m reaching out for some guidance regarding App Store Guideline 3.1.3(c) and an issue we’re facing during the app review process. Here’s the situation: Our app is designed exclusively for organizations (e.g., businesses, schools, etc.) and is not intended for individual users, consumers, or families. Organizations purchase access to our services directly through our website, and we manually onboard them into the app. Individual users cannot register themselves or gain access to the app unless they are part of a pre-approved organization. However, during the app review process, we received the following feedback: We noticed in our review that your app offers enterprise services that are sold directly to organizations or groups of employees or students. However, these same services are also available to be sold to single users, consumers, or for family use without using in-app purchase. We believe this is a misunderstanding because: Our app does not allow individual users or families to register or access the app. All purchases are made outside the App Store via our website, and only organizations can complete these transactions. We manually onboard organizations and their users – there is no way for individuals to sign up or pay for access within the app. We’ve already explained this to the App Review team in App Store Connect, but we’re still facing issues. Has anyone else experienced something similar? If so, how did you resolve it? Here’s what we’ve done so far: Clearly stated in the app description that the app is for organizations only. Ensured that individual users cannot register or pay for access within the app. We’d appreciate any advice or insights from the community on how to better communicate this to the App Review team or if there’s something we might be missing. Thank you in advance for your help! Best regards, Bashar
1
0
218
Jan ’25
How to Restrict In-App Purchases to a Specific User Email or Differentiate Users?
Hello, I am implementing In-App Purchases in my app and want to ensure that only users whose email matches their Apple ID email (the account used on the device as apple account) can purchase the subscription. Is it possible to retrieve the Apple ID email from the device or verify if the email matches the user's email in the app? If this is not feasible, what is the recommended approach to differentiate users and associate subscriptions with specific users in a secure way? For instance, how do I ensure that a subscription is tied to the correct user within my app? I understand privacy constraints, but I am trying to find the best way to match the subscription to the correct user while adhering to Apple's guidelines. Any guidance or best practices would be appreciated. Thank you!
1
0
230
Jan ’25
Transaction.Id from Product.Purchase is different from the transactionId notified by the server notification
Hi, In an auto-renewable subscription scenario, I receive a transaction from Product.Purchase and then send the transaction ID (e.g., 500000000738201) to my API server. After receiving the response, I called transaction.finish(). The account has purchased the subscription before and expired. So it's re-subscribe. And then, I received a RESUBSCRIBE notification from Apple’s server to my API server. I noticed a discrepancy where the transaction ID in the notification is decreased by one (e.g., 500000000738200 instead of 500000000738201). I’m wondering why this discrepancy occurs and how it happens. Best regards, RoyHuang
0
0
193
Jan ’25
Business model changes by using the app transaction
Hello, I’m trying to change my business model within the app, and following Apple’s documentation guidelines HERE I created this task in the main view of the app. It seems to work perfectly in the simulator, on physical devices, and on TestFlight. However, after releasing it to production and uploading the new version to the App Store, it doesn’t work, and all users, whether new or existing, are asked to subscribe. In the console, it appears to retrieve the transactions correctly, but in production, I’m not sure how to view the console or see what it’s retrieving. Here the sandbox receipt I obtained AppTransaction.shared obtained: { "applicationVersion" : "1", "bundleId" : "com.anestesiaIB.Drugs-Infusion-Calc", "deviceVerification" : "6M0Nnw14nSEOBVTPE\/\/EfnWSwLm7LFSlrpFEwxgH74SBHp5dSzBEm896Uvo42mwr", "deviceVerificationNonce" : "8a8238c0-0aee-41e6-bfb0-1cfc52b70fb6", "originalApplicationVersion" : "1.0", "originalPurchaseDate" : 1375340400000, "receiptCreationDate" : 1737577840917, "receiptType" : "Sandbox", "requestDate" : 1737577840917 } This are the processing log while verified the receipt New business model change: 1.7 Original versionéis components: ["1", "0"] Major version: 1, Minor version: 0 This user is premium. Original version: 1.0 This is my task... .task { do { let shared = try await AppTransaction.shared if case .verified(let appTransaction) = shared { let newBusinessModelVersion = (1, 7) // Representado como (major, minor) let versionComponents = appTransaction.originalAppVersion.split(separator: ".") if let majorVersion = versionComponents.first.flatMap({ Int($0) }), let minorVersion = versionComponents.dropFirst().first.flatMap({ Int($0) }) { if (majorVersion, minorVersion) < newBusinessModelVersion { self.premiumStatus.isPremium = true isPremium = true } else { let customerInfo = try await Purchases.shared.customerInfo() self.premiumStatus.isPremium = customerInfo.entitlements["premium"]?.isActive == true isPremium = self.premiumStatus.isPremium } } else { print("Error: obteining version components") } } else { print("Not verified") } } catch { print("Error processing transaction: \(error.localizedDescription)") } }
0
0
217
Jan ’25
Can users create their own subscription plans?
I'm considering developing an app where users can create their own subscription plans by freely setting their prices, similar to YouTube's membership feature. I understand that in-app purchases must be used to unlock features within the app. With that in mind, I searched for APIs to enable this functionality but couldn't find relevant information. When I contacted Apple directly, they mentioned that they couldn't provide specific answers unless the app is under review. If anyone has knowledge about the following points, I would greatly appreciate your response: Is it possible to implement a feature similar to YouTube's membership using in-app purchase APIs? If it's not feasible with in-app purchases, is it allowed to use external payment services like Stripe?
1
0
146
Jan ’25
Sandbox environment extremely unreliable
I have two sandbox users in App Store Connect, as I'm trying to test in-app purchases and Family Sharing. They're set up fine; I can make purchases in the app. The issue is that the refund request sheet in my app sometimes shows properly and lets me request a refund, but I'd say >80% of the time the sheet just shows "Cannot Connect" with a "Retry" button. Hitting that button doesn't ever result in the sheet showing the refund page. The only fix for this is to delete the app from the device, and restart the device. This has to be a joke, right? I need to be able to test this IAP, and the sandbox environment is useless most of the time. Why? Anyone experiencing this sort of issue?
1
1
286
Jan ’25
In-app purchases - why so frustrating?
I'm adding my first in-app purchase to an app, and I'm finding the process incredibly frustrating. Aside from the Apple Developer Documentation not being clear enough, and kind of glossing over the technical steps required (and their sample code being woefully inadequate), App Store Connect and the testing sandbox simply don't work as they say they do. For example, in my app I've purchased the IAP and now I want to request a refund. I select the purchase, I choose a refund reason, and this page says, "To set up a test for approved refunds, select any refund reason on the refund request sheet, and submit the sheet. The App Store automatically approves the refund request in the testing environment." Well, when I re-launch the app the purchase is still there. I can't request a refund again because it says this is a duplicate refund request, so it knows that the purchase has had a request, and it's supposed to have automatically refunded it, but it clearly hasn't. So, I try clearing the purchase history via the Settings app > Developer > Sandbox Apple Account. Same thing. Purchase remains. Try clearing purchase history in App Store Connect. Same thing. How on Earth does anyone get an in-app purchase to work when the entire testing environment is so badly executed? How do I get past this? The IAP is the last part of the app that needs to be implemented, and I've lost a week on this already.
1
0
321
3w
Does the Apple Store support variable recurring payments like Stripe?
Stripe offers variable payment structures, also known as "irregular recurring payments," which include: Usage-based billing: Charges amounts based on usage during the billing cycle (e.g., minutes used or energy consumed). Quantity-based billing: Charges a pre-agreed amount based on quantity (e.g., number of users in a subscription). Is it possible to implement this type of billing in the Apple Store for apps? How would variations in amounts be handled?
0
0
242
Jan ’25
In-app purchases fail: "Password reuse" error?
I'm trying to implement my first in-app purchase, and I've created the IAP in App Store Connect, and created a sandbox account. When I open Settings > Developer in the iPhone Simulator, there is a "Sandbox Apple Account" option at the bottom. If I click the blue "Sign In" link I'm asked for the email and password, so I enter the correct credentials for the sandbox account. The "Sign In" text goes grey for a few seconds, then it goes blue again. It never changes to show that I'm signed in. Should it? (I think so.) Do I need to sign into the Simulator's Apple Account, too? (I don't think so.) Anyway, aside from that, in my app the IAP is listed and I have a button to purchase it. When I click it I'm asked for the email and password to sign into the Apple Account. I enter the correct sandbox email and password (they are definitely correct) and I see this in the Xcode console: Purchase did not return a transaction: Error Domain=ASDErrorDomain Code=530 "(null)" UserInfo={client-environment-type=Sandbox, NSUnderlyingError=0x600000d0c7b0 {Error Domain=AMSErrorDomain Code=100 "Authentication Failed The authentication failed." UserInfo={NSMultipleUnderlyingErrorsKey=( "Error Domain=AMSErrorDomain Code=2 \"Password reuse not available for account The account state does not support password reuse.\" UserInfo={NSDebugDescription=Password reuse not available for account The account state does not support password reuse., AMSDescription=Password reuse not available for account, AMSFailureReason=The account state does not support password reuse.}", "Error Domain=AMSErrorDomain Code=0 \"Authentication Failed Encountered an unrecognized authentication failure.\" UserInfo={NSDebugDescription=Authentication Failed Encountered an unrecognized authentication failure., AMSDescription=Authentication Failed, AMSFailureReason=Encountered an unrecognized authentication failure.}" ), AMSDescription=Authentication Failed, NSDebugDescription=Authentication Failed The authentication failed., AMSFailureReason=The authentication failed.}}} Why is it talking about password reuse? AFAIK, I have only one sandbox account for this app (and none for any of my other apps), and this is the only one of my apps that has an IAP. Any ideas on how to get an IAP working? Thanks!
2
1
844
Jan ’25
unable to get subscription products macos iap xcode swift
Hi Apple Support, I am encountering an issue while testing in-app purchases in the sandbox environment. I have created a sandbox tester account Logged out of the App Store and System Settings on my Mac. My main developer account is signed in under Sign In & Capabilities in Xcode. The Bundle ID matches the one configured in App Store Connect. The Product ID I am querying also matches the configuration. Deleting the app and reinstalling. Restarting my Mac. When running my code in debug mode, I observe the following: Running debug build App Store environment: Production [1b294b55] Error updating Storefront: Error Domain=StoreKit_Shared.StoreKitInternalError Code=7 "(null)" Valid products: [] Invalid product IDs: ["com.x.x.x.monthly"] No products found The Product ID (com.x.x.x.monthly) matches the one I have configured in App Store Connect. The bundle id matches. When I create a StoreKit Configuration file in Xcode and sync it with my app, I can see the product IDs correctly. Below are the relevant code snippets for fetching and handling products: func fetchProducts() { guard !productIDs.isEmpty else { print("No product IDs configured") return } let request = SKProductsRequest(productIdentifiers: productIDs) request.delegate = self print("Starting product request...") request.start() } func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) { DispatchQueue.main.async { print("Valid products: \(response.products)") print("Invalid product IDs: \(response.invalidProductIdentifiers)") self.products = response.products if self.products.isEmpty { print("No products found") } else { print("products not empty") for product in self.products { print("Fetched product: \(product.localizedTitle) - \(product.priceLocale.currencySymbol ?? "")\(product.price)") } } } } func debugStoreSetup() { if let receiptURL = Bundle.main.appStoreReceiptURL { if receiptURL.lastPathComponent == "sandboxReceipt" { print("App Store environment: Sandbox") } else { print("App Store environment: Production") } } else { print("No receipt found") } } Could you help identify why my app is not recognizing the Product ID in the sandbox environment? Thank you for your assistance.
2
2
398
Jan ’25
IAP refund decision changed
We integrated App Store Server notification, to get notified about CONSUMPTION_REQUESTS and REFUND notifications. In the data, we noticed same transactionId have multiple REFUND decisions, usually REFUND_DECLINED and then REFUND. Why is that? Did user contact customer support ? For the second (or later) REFUND decision, CONSUMPTION_REQUEST notifications are usually not sent, but thats not always the case. Sometimes, REFUND decision are the same. Sometimes, we get even 3 or more REFUND related notifications for same transactionId, e.g: 2024-12-02: REFUND_DECLINED 2024-12-05: REFUND_DECLINED 2024-12-12: REFUND Do user request refund again ? Do they contact customer support ? But I can not explain why sometimes status it REFUND at first, but then later REFUND_DECLINED. Thank you already in advance:)
0
0
203
Jan ’25
Response of the server-side verifyReceipt endpoint when using offer codes
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
0
0
194
Jan ’25