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.

App Store Server API

Posts under App Store Server API tag

35 Posts
Sort by:
Post not yet marked as solved
1 Replies
576 Views
Hi team, I would to extract the order information of customer's in-app purchase on app store to match against sales revenue. Looking through the Apple API documentation, I am taking the following steps Get status and history for in-app purchase transactions through the App Store Server API by calling the Get Transaction History endpoint. This returns me the purchase date, transactionID, and quantity information. There is also a field called productID which was created in Apple Store Connect. However i would also need to extract price information such as currency and item unit price. I looked through Apple Store Connect API which contains in app purchase information. How should i retrieve these fields from the response from Get Transaction History endpoint. Should I use the productID and what are the subsequent API endpoints to query?
Posted
by yhzheng.
Last updated
.
Post not yet marked as solved
1 Replies
198 Views
I read the following documentation: https://developer.apple.com/documentation/appstoreserverapi/get_refund_history/ But the originalTransactionId parameter is required. As far as I know, it is associated with a certain consumer, so whether this API can only check the refund order associated with a certain consumer, not the entire app I want to regularly query the refund orders in the entire app without App Store Server Notifications. Is this possible?
Posted
by yogg.
Last updated
.
Post not yet marked as solved
1 Replies
97 Views
Hello all, we have in-app purchases in our application. Our server is used to verify all transactions. We get transaction_id from verifyReceipts API along with other data. In the report that we get from Apple, there is no transaction_id or any common field that can uniquely identify a payment. Can we add transaction_id into reports somehow?
Posted Last updated
.
Post not yet marked as solved
2 Replies
131 Views
Good morning, we have a backend making calls to the subscriptions API to check the status of users subscriptions. Now, besides the check we need sometimes to extend subscriptions, using the api: https://api.storekit.itunes.apple.com/inApps/v1/subscriptions/extend/{originalTransactionId} To call this api we need a signed JWT Token and the originalTransactionId. Now, calling the api with the concrete parameters we receive always error response like this: StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers: { Date: Wed, 17 May 2023 14:48:36 GMT Server: Apache Strict-Transport-Security: max-age=31536000 X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Content-Security-Policy: default-src 'self' *.apple.com; X-Content-Type-Options: nosniff Content-Length: 196 Content-Type: text/html; charset=iso-8859-1 }; content is 404 Not Found Not Found The requested URL was not found on this server. Consider that the originalTransactionId is taken from the response of a previous verifyReceipt API, and the error does not seem related to the authentication (so I tend to exclude issues with the signed token) What could be the problem? What is the right way to extend a subscription via API call? Thank you.
Posted
by sarmenia.
Last updated
.
Post not yet marked as solved
4 Replies
409 Views
We have implemented an auto-renewing subscription as an in-app-purchase for our iOS application. We are consuming the App Store Server Notifications for subscription transactions in order to update the user's account (and thereby maintain their 'Pro' access to our application). Sometimes those notifications never come to our server, and there is no evidence that they were even attempted to be sent to us. We have had some users report to our Customer Support team that they have successfully made a purchase of the subscription, but that they were not granted 'Pro' access. For the large majority of users this is not happening and all is well, but for some users the notifications just never come from the App Store Server API. We keep a record of all notifications that we receive from the App Store, and for these users we never received the "SUBSCRIBED" event. We have checked the Notification History API and there are no reports of any failure to send notifications to our server. We have checked our server logs for any sign of failure to receive incoming web requests, and there is no sign of these missing notifications. We have verified that our server supports ATS. We are keeping the transaction.originalID for all our users who are subscribed to the auto-renewing subscription. We have used this value to do some lookups into the transaction history and subscription status of the users who are being affected. Here is an example of our findings from those lookups: From the transaction history endpoint, we received an error: “Invalid transaction identifier”. From the subscription status endpoint, we received a response with the information for that user's active, valid subscription. We never received any App Store Server Notifications about this user’s subscription, and the transaction history API tells us it is an invalid transaction ID. We believe that the fact that the subscription status API returned the information showing that this user’s subscription is active and valid, and that the notification history API shows no sign of a failure to send us notifications about that subscription, shows that the App Store Server API never attempted to send us any notification for this user’s subscription. The same is true for a significant number of other users of our service. Can anyone help us determine what is going on, and how to best support these customers? It seems as though there was never an attempt to send these notifications to our server, but our users provide proof that they do in fact have an active subscription, for which they have paid (receipt email from Apple with a valid order ID).
Posted Last updated
.
Post not yet marked as solved
1 Replies
241 Views
Hi all, I need to cancel a subscription (unilaterally), because my client has violated the rules for using my service, how can I do this without depending on the client to cancel? I thank you for your attention.
Posted
by hcampos.
Last updated
.
Post not yet marked as solved
1 Replies
237 Views
Hello everyone, I've been having some trouble with the App Store Connect API recently. Specifically, the price tiers have changed from 1,2,3,4 to 10000,10001,10002, etc. I modified my code accordingly and it worked fine for a while, but now I'm getting 500 errors. I'm trying to make a POST request to the inAppPurchasePriceSchedules endpoint with the following JSON body: POST https://api.appstoreconnect.apple.com/v1/inAppPurchasePriceSchedules { "data": { "relationships": { "inAppPurchase": { "data": { "id": 1111111111, "type": "inAppPurchases" } }, "manualPrices": { "data": [ { "id": "price_point_id_tiers_1000x", "type": "inAppPurchasePrices" } ] } }, "type": "inAppPurchasePriceSchedules" }, "included": [ { "attributes": { "startDate": null }, "id": "price_point_id_tiers_1000x", "relationships": { "inAppPurchasePricePoint": { "data": { "id": "price_point_id_tiers_1000x", "type": "inAppPurchasePricePoints" } }, "inAppPurchaseV2": { "data": { "id": 1111111111, "type": "inAppPurchases" } } }, "type": "inAppPurchasePrices" } ] } Headers: Authorization: Bearer xxxx accept: application/json Can anyone help me troubleshoot this issue? Thank you in advance for your help!
Posted Last updated
.
Post not yet marked as solved
3 Replies
204 Views
I'm trying to create a test notification, but getting Unauthorized from the API. I've created an In-App Purchase key, and using the following code to generate the JWT Token: from datetime import datetime, timedelta from time import time, mktime import jwt dt = datetime.now() + timedelta(minutes=19) headers = { "alg": "ES256", "kid": "B7J<..>", "typ": "JWT", } payload = { "iss": "acaf4d66-ea<..>", "iat": int(time()), "exp": int(mktime(dt.timetuple())), "aud": "appstoreconnect-v1", "bid": "com.w<..>" } with open("SubscriptionKey_B7J<..>.p8", "rb") as fh: signing_key = fh.read() gen_jwt = jwt.encode(payload, signing_key, algorithm="ES256", headers=headers) print(f"{gen_jwt}") One of the request IDs that failed: FPJYAOSUZTFXXIKUELW6QE7F54.0.0
Posted
by IgnasV.
Last updated
.
Post not yet marked as solved
1 Replies
240 Views
We are looking to create an integration with the Apple App Store through APIs to download sales from paid apps when customers download the app from the App Store on behalf of app developers. In countries with foreign currency controls, such as China, Apple developers must provide revenue proof (i.e. sales from paid apps when users download the app from the App Store) to transfer their earnings to their local bank account. Based on what we gather from the documentation, the App Store Server API seems to be meant for in-app purchases only. Are there Apple APIs exposed to retrieve the information we need specifically the order ID, order date, currency, quantity, app price and app name for revenue from paid app downloads?
Posted
by yhzheng.
Last updated
.
Post marked as solved
1 Replies
243 Views
The Manage in-app purchases on your server of WWDC 2021 shows the following flow: The third arrow in the screenshot dictates the decoded transaction is sent from the customer's iPhone to our server. Because our subscription management service and app backend are different services, we think the app shouldn't add another server to connect. I wonder, after receiving INITIAL_BUY, if we can get the transaction/receipt using App Store Server API, i.e. we want the following flow: Is this possible for now? Or is it essential to use customers' devices to decode transactions and receipts?
Posted Last updated
.
Post not yet marked as solved
25 Replies
3.6k Views
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?
Posted
by w_grand.
Last updated
.
Post not yet marked as solved
4 Replies
679 Views
I'm trying to test getting subscription status from the sandbox App Store Server API with a originalTransactionId generated from a TestFlight build of my app. I'm hitting the endpoint correctly and getting a 200 response with the following JSON: {"environment":"Sandbox","bundleId":"","data":[]} Why is the data property an empty array, instead of containing the subscription and signed transaction details?
Posted
by henrybk.
Last updated
.
Post marked as solved
1 Replies
746 Views
StoreKit 1: Server used Server API VerifyReceipt to determine whether it's in trail period or not. The latest_receipt_info contains "is_trail_period" attribute. StoreKit 2: Server only get offerType=1 in JWS transaction? How can I determine whether it's a free trial or any other kind of Introductory Offers('Pay As You Go' or 'Pay Up Front') when offerType=1 in StoreKit 2. Thanks!
Posted
by YangFeng.
Last updated
.
Post not yet marked as solved
1 Replies
456 Views
Hello, I need to access App Store Server API from my production server to check the subscription status of the users. This is the Java code i'm using, that works perfectly on my computer office, and does not work on the production server and other development machines (401 error code, authorization). Does anyone have any idea where I'm going wrong? The amazing thing is that it only works on one machine and nowhere else. private static final String ISSUER_ID = "68a25a66-32e6-4ad2-8a72-5a60d27f4719"; private static final String PRIVATE_KEY_FILENAME = "SubscriptionKey_Z7U53CT8QU.p8"; public static final int CONNECTION_TIMEOUT = 10000; public static final void main(String[] args) throws Exception { String token = prepareJwtToken(); System.out.println(token); String jsonData = fetchUrl( "https://api.storekit-sandbox.itunes.apple.com/inApps/v1/subscriptions/1000000849259545", token); System.out.println(" * * * * *"); System.out.println(jsonData); } public static PrivateKey getPrivateKey(String filename) throws IOException { String algorithm = "EC"; String content = new String(Files.readAllBytes(Paths.get(filename)), StandardCharsets.UTF_8); try { String privateKey = content.replace("-----BEGIN PRIVATE KEY-----", "") .replace("-----END PRIVATE KEY-----", "").replaceAll("\\s+", ""); KeyFactory kf = KeyFactory.getInstance(algorithm); return kf.generatePrivate(new PKCS8EncodedKeySpec(Base64.getDecoder().decode(privateKey))); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Java did not support the algorithm:" + algorithm, e); } catch (InvalidKeySpecException e) { throw new RuntimeException("Invalid key format"); } } private static final String prepareJwtToken() throws JSONException, IOException { long unixTime = LocalDateTime.now().toEpochSecond(ZoneOffset.UTC); PrivateKey privateKey = getPrivateKey(PRIVATE_KEY_FILENAME); Map&lt;String, Object&gt; claims = new HashMap&lt;&gt;(); claims.put("iss", ISSUER_ID); claims.put("iat", unixTime); claims.put("exp", (unixTime + (60 * 30))); claims.put("aud", "appstoreconnect-v1"); claims.put("bid", "it.iperdesign.fantaclub"); Map&lt;String, Object&gt; headers = new HashMap&lt;&gt;(); headers.put("alg", "ES256"); headers.put("typ", "JWT"); headers.put("kid", "Z7U53CT8QU"); @SuppressWarnings("deprecation") String token = Jwts.builder().setHeader(headers).setClaims(claims) .signWith(io.jsonwebtoken.SignatureAlgorithm.ES256, privateKey).compact(); return token; } private static final String fetchUrl(String urlToFetch, String token) throws IOException { URL url = new URL(urlToFetch); URLConnection urlCon = url.openConnection(); urlCon.setRequestProperty("Authorization", "Bearer " + token); urlCon.setReadTimeout(CONNECTION_TIMEOUT); urlCon.setUseCaches(false); InputStream in = null; try { in = urlCon.getInputStream(); String jsonData = new String(in.readAllBytes(), StandardCharsets.UTF_8); return jsonData; } finally { if (in != null) { in.close(); } } } }
Posted
by marco80pg.
Last updated
.
Post marked as solved
3 Replies
574 Views
I'm testing this App Store Server API in the sandbox environment and it seems like this API cannot be properly tested there. https://developer.apple.com/documentation/appstoreserverapi/extend_a_subscription_renewal_date I can only call this API on an active subscription, but the effectiveDate in ExtendRenewalDateResponse is the same value as the subscription's original expiry date and is not extended at all by the extendByDays I specified in the API request. Also the subscription doesn't renew after it expires, so even if the call to the subscription extension API appeared to have succeeded it has no actual effect. I suppose this is not the intended behavior and expect that the production environment to behave differently. Is the expiresDate in the current subscription supposed to be extended after this API call? Or would it remain the same and the extended part of the subscription become a separate transaction after expiresDate?
Posted
by crauss77.
Last updated
.
Post not yet marked as solved
2 Replies
758 Views
Free trial is a discount method that can be used in Introductory offers, promotional offers, and promotion codes, and it is not necessarily to use in promotional offers. Going further, is there a way to judge whether the offer is Pay as you go, Pay up front, or free trial?
Posted
by daz2yy.
Last updated
.
Post not yet marked as solved
0 Replies
951 Views
Hello, I need to get reports of summary app rating per country or region. I see the data is available in app store connect UI: https://help.apple.com/app-store-connect/#/devd15088dd0 However, I can not find an api to automatically retrieve those statistics. Anyone can help me with this? Thanks in advance!
Posted
by smbata.
Last updated
.
Post not yet marked as solved
0 Replies
698 Views
Hello, Are there any plans to release an api that allows you to report reviews? We have now an App Store Connect Api to retrieve customer reviews + responses and also the possibility to respond to them via this API.
Posted
by Lamyae.
Last updated
.