App Store Server API

RSS for tag

Call this REST API from your server to request and provide information about your customers' in-app purchases.

Posts under App Store Server API tag

95 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Questions about ConsumptionRequest properties
Hello. platform: Please let me know which platform 'Non-Apple platform' is referring to. For example, Google or Amazon? And is it correct to mean the platform that consumed the products received due to in-app purchases? playTime: Does 'playTime' mean the time when the customer purchased the app and actually accessed the app? Or do you mean the time you accessed after the in-app purchase?
1
0
80
4h
How the app behaves when an AccountNotFoundError is returned by the App Store Server API.
We are currently implementing in-app purchases with auto-renewing subscriptions. If an AccountNotFoundError is returned from the App Store Server API, is it correct for the app to stop the service offered with that subscription? The documentation does not go into detail, so I am just checking to be sure. https://developer.apple.com/documentation/appstoreserverapi/accountnotfounderror
0
0
78
3d
Transactions with the same webOrderLineItemId value but different transactionId
Hello I called the 'Get Transaction Info' API with Auto-Renewable Subscription product type transactionId. I received a success response and called the 'Get Transaction History' API with the value 'originalTransactionId'. The response 'transaction' of the 'Get Transaction History' API that matches the 'webOrderLineItemId' value received through the 'Get Transaction Info' API was found, but the 'transactionId' value was different. Why is this happening? Which of the two transactions is normal? https://developer.apple.com/documentation/appstoreserverapi/get_transaction_info https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history
0
0
67
3d
Can I change the availability of the auto-renewal subscription item using the API?
In my application, I have to create and remove many auto-renewal subscription items programmatically using an API. Like the YouTube app, when a user creates a channel, I will create a subscription item with their name, and when they shut down the channel, I will cancel the whole subscription and remove the item. I found that I can create subscription items using the following API: https://developer.apple.com/documentation/appstoreconnectapi/create_an_auto-renewable_subscription In the following document, I found that I can stop selling and cancel subscriptions at https://appstoreconnect.apple.com by changing the availability of item from "Cleared for Sale" to "Remove from Sale": https://developer.apple.com/help/app-store-connect/manage-subscriptions/set-availability-for-an-auto-renewable-subscription My question is can I stop selling and cancel subscriptions using an API? The App Store Connect API offers modifying subscription availability, but it only offers changing sales countries: https://developer.apple.com/documentation/appstoreconnectapi/modify_an_auto-renewable_subscription They also offer a subscription deletion API, but I'm not sure if it'll work as I need: https://developer.apple.com/documentation/appstoreconnectapi/delete_a_subscription How do you manage auto-renewal subscription items when you stop selling them? Is there any API or do you do it manually? Thank you.
0
0
117
1w
Suddenly receiving error 21002 from verifyReceipt endpoint for sandbox receipt
We started getting error code 21002 from the verifyReceipt endpoint today for any receipt passed to it: {     "status": 21002 } I have created a new sandbox tester, and cleared and reinstalled the application before attempting the purchase. I'm seeing this response through RevenueCat's receipt validation tool (https://www.revenuecat.com/app-store-receipt-validation/) and from a direct cURL command: curl --location --request POST 'https://sandbox.itunes.apple.com/verifyReceipt' \ --header 'content-type: application/json' \ --data-raw '{     "receipt-data":"{RECEIPT_DATA}",     "password":"{SECRET}",     "exclude-old-transactions":"false" }' This was working as of yesterday, but seems to be failing for anyone who has tried today. Has anyone else run into issues with this?
28
7
7k
1w
Migrate from the verifyReceipt API to the new
Apple has deprecated the https://buy.itunes.apple.com/verifyReceipt API and encourages users to migrate to the new https://api.storekit.itunes.apple.com/inApps/v1/transactions/{transactionId} API. However, during the migration, a problem was discovered. Previously, with the verifyReceipt API, the 21007 status code could be used to distinguish between the sandbox and production environments. Now, with the new API, if the {transactionId} is from the sandbox environment, it will directly return {"errorCode":4040010,"errorMessage":"Transaction id not found."}. How can I distinguish whether a {transactionId} is generated in the sandbox environment or the production environment?
5
1
279
1w
Empty response returned on read instances GET request
I'm trying following endpoint to get instances of a report, https://api.appstoreconnect.apple.com/v1/analyticsReports/{id}/instances but getting an empty response: {'data': [], 'links': {'self': 'https://api.appstoreconnect.apple.com/v1/analyticsReports/r8-4433f324-ba58-44d0-8b7f-f8976ef36646/instances'}, 'meta': {'paging': {'total': 0, 'limit': 50}}} I'm accessing "App Sessions Standard" report and correctly passing the instance id to get instances of this report. Also made sure that the App I'm accessing have App sessions data in the console. code.txt This is the order of api requests I implemented: 'https://api.appstoreconnect.apple.com/v1/analyticsReportRequests' 'https://api.appstoreconnect.apple.com/v1/analyticsReportRequests/{report_id}/reports' 'https://api.appstoreconnect.apple.com/v1/analyticsReports/{report_id}/instances' Source code is provided in the attached file. Would be grateful if someone can help resolve this issue.
0
0
146
1w
disable ATS
My App needs to send and receive messages to the server, but my server does not have SSL, so I can only disable ATS in the development stage. But if I want to put the app on the shelf, then I still disable ATS when I put it on the shelf, and the server still does not have SSL. Will it be packaged? Is pp warned and terminated by Xcode? Will it be rejected by the Apple audit department? Can it be put on the App Store normally and provided to all users? Note: My server is completely safe without any security risks. I didn't apply for SSL just because I didn't have enough funds.
2
0
238
2w
How to Update App Store Metadata via App Store Connect API Using Postman
I need help updating the description, keywords, what's new, and promotional text for my app on the App Store using the App Store Connect API through Postman. I already have my access token. I need to update the data for each language, I changed to PATCH, but what is the url to patch? And what json should I send?
1
0
189
2w
Server Side validation for In-App Purchase
Hi, Our application offers 3 non-renewing subscriptions. I have integrated the necessary code, and our App Store Account Paid Agreement status is Active. Transactions are successfully completed in the sandbox environment. However, I am facing difficulties with server-side validation. The /verifyReceipt API is deprecated, and I need an alternative method for server-side validation. The Apple documentation is quite confusing, and I couldn't find any articles related to the new approach for server-side validation. I would greatly appreciate it if you could provide a detailed guide on how to perform server-side validation with the new method. Thank you in advance.
1
0
173
2w
App Store Server API: > 4 second latency
We're currrently migrating from the deprecated /verifyReceipt endpoint to the new App Store Server API. Context: We use Storekit 2 on the client. Even though it validates transactions client-side, our app also persists subscription data (Original Transaction ID + Product ID) to our DB, so it's necessary to validate the purchases server-side as well. When calling the new endpoints (for example, Get All Subscription Statuses or Get Transaction History ), I'm currently seeing 4+ second latency. This is the case when passing in only a Transaction ID and hitting the Production endpoint, even for Transaction IDs that don't exist in Production (eg, Sandbox transactions). Are there any plans to improve the performance of this API? As it currently stands, we're holding off on the migration -- 4 seconds is far too impactful on both our user experience and our backend system versus the existing 300-400ms latency of /verifyReceipt.
3
0
179
3w
Are there cases where a response to an error returned from the AppStore Server API is considered a subscription cancellation by the user?
According to the following document, when the AppStore Server API is executed and the account does not exist, the response "errorCode: 4040001" is returned. If this response is returned, is it safe to assume that the account has been deleted and treat the subscription as cancelled? Also, please let us know if there are any other error codes other than this error code that can be used to determine that the subscription has been cancelled. https://developer.apple.com/documentation/appstoreserverapi/accountnotfounderror
1
0
256
3w
getTransactionHistory missing transactionId with productype Consumable
Hello everyone. I'm try to get out of verifyReceipt for my app. I'm try to following this link https://developer.apple.com/videos/play/wwdc2023/10143/ Then I'm testing by using old receipt from my app. Using receiptUtility.extractTransactionIdFromAppReceipt(appReceipt); I got this transaction Id 160000542059454. Then follow the step in the video to get all transaction history I realize that it missing transaction which have productype as consumable. If I'm using getTransactionInfo an pass that Id I can fetch the info of that transaction. So my question is how to get all transaction Id history.
2
0
550
3w
App store connect API returns 401 Sandbox and 404 Production
I also still getting the same error from sandbox "x": "Invalid response: Client error: GET https://api.storekit-sandbox.itunes.apple.com/inApps/v1/transactions/2000000632845273 resulted in a 401 Unauthorized response", while for production url "x": "Invalid response: Client error: GET https://api.storekit.itunes.apple.com/inApps/v1/transactions/2000000632845273 resulted in a 404 Not Found response:\n{"errorCode":4040010,"errorMessage":"Transaction id not found."}\n",
1
0
219
Jun ’24
Notification Received on Consumable Purchase
Hello, I am encountering an issue where I receive an App Store Server Notification V2 upon the purchase of a consumable item. I have configured the App Store Server Notification V2 endpoint to handle notifications related to subscription products. However, I did not expect to receive notifications for consumable purchases. The notification includes the following signedPayload decoded into the ResponseBodyV2DecodedPayload object with the following values: notificationUUID: 3cd6410b-0c89-4247-aba5-20710e79895e notificationType: null subtype: null The transaction information decoded from the ResponseBodyV2DecodedPayload object is as follows: transactionId: 2000000633622618 webOrderLineItemId: null productId: heart_2 To debug, I called the Get Notification History API of the App Store Server API, and the mentioned notification for the consumable product purchase is not included in the history. Only notifications related to subscription product purchases are retrieved. According to the notification type documentation, there is no explanation for cases where both notificationType and subtype are null, nor is there any mention of receiving notifications for consumable purchases. Therefore, I am uncertain how to interpret and handle this notification. Could you please provide an explanation or guidance on this issue? Thank you. References: https://developer.apple.com/forums/thread/737592 https://developer.apple.com/documentation/appstoreservernotifications/notificationtype
2
0
296
Jun ’24
server-side iap authentication error code 401
I created a project to validate in-app purchase receipts using c# but I always get error 401, you don't have permission, I followed the instructions exactly but still failed, I created a private key in Certificates, IDs & Profiles and download the .p8 file but it still doesn't work, I also created and tried another key in Users and Access > Integrations > App Store Connect API and also In-App Purchase but it still doesn't work. When I try to put the created token on jwt.io, I always get an Invalid Signature error using Jose; using System; using System.Collections.Generic; using System.Net.Http.Headers; using System.Net.Http; using System.Security.Cryptography; using System.Threading.Tasks; using System.IO; using System.Net; namespace CheckIAP { internal class Program { static async Task Main(string[] args) { string jwtToken = GenerateAppStoreJwtToken(); string transactionId = "110002159078***"; Console.WriteLine(jwtToken); string url = $"https://api.storekit.itunes.apple.com/inApps/v2/history/{transactionId}"; using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", jwtToken); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = await client.GetAsync(url); if (response.IsSuccessStatusCode) { string responseData = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseData); } else { Console.WriteLine($"Error: {response.StatusCode}, {response.ReasonPhrase}"); string responseData = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseData); } } Console.ReadLine(); } public static string GenerateAppStoreJwtToken() { string teamId = "PZG479xxxx"; string keyId = "JCXH26xxxx"; string issuerId = "7aa0c9c2-***-***-***-xxxx"; string bundleId = "com.***.***"; const string API_KEY = "MIGTAgEAMBMGByqGSM...."; var header = new Dictionary<string, object>() { { "alg", "ES256" }, { "kid", keyId }, { "typ", "JWT" } }; var payload = new Dictionary<string, object> { { "iss", issuerId }, { "iat", DateTimeOffset.UtcNow.ToUnixTimeSeconds() }, { "exp", DateTimeOffset.UtcNow.AddMinutes(15).ToUnixTimeSeconds() }, { "aud", "appstoreconnect-v1" }, { "sub", bundleId } }; var key = CngKey.Import(Convert.FromBase64String(API_KEY), CngKeyBlobFormat.Pkcs8PrivateBlob); return Jose.JWT.Encode(payload, key, JwsAlgorithm.ES256, header); } } }
2
0
248
Jun ’24
Finance Report
Hi, I'm just using the APPLE api to get the sales, installs and profit data for the month but I don't know why I think I'm not getting all the data because if I look at the financial cut for the month (APRIL FOR EXAMPLE) I see that APPLE it pays me XYZ amount, but in the API, if I get the profit or the sales, neither gives me the correct amount from the financial report. I am doing something wrong? how can i get the correct amount using the APIs
0
0
167
Jun ’24
Cancel Subscriptions on Behalf of Customer like Netflix (App Store Server API)
I recently had a request from a Product Owner to implement capability like Netflix has to enable users to switch their payment method from App Store Subscription to Credit Card on our website, as per capability that Netflix has in their account management portal. We tested it today with a colleague who was paying for Netflix through iOS in-app subscription: In the Netflix account management pages it showed that he was currently paying via In App Subscription He updated his payment method to Credit Card in their website's account management portal. Almost immediately after adding his Credit Card in his iOS Subscription Management settings (we could see the the subscription had been set to no longer renew, with an expiry date) How is this done - I can't see any API in App Store Server API documentation that gives us a way of cancelling / preventing renewal of subscriptions on behalf of a user... But Netflix can clearly do it somehow...
0
0
277
Jun ’24