App Store Server Library

RSS for tag

App Store Server Library is the library for the App Store Server API and App Store Server Notifications. It provides an API client, a JWS signed data verifier, a utility to extract a transaction id from a receipt, and a promotional offer signature.

Posts under App Store Server Library tag

20 Posts
Sort by:
Post not yet marked as solved
2 Replies
162 Views
Hi I am Justin, I have vs code and I am asking a question and I have never programed in my life or written a code I am just asking when your done writing a code how do you upload it to like say Xbox etc like they all do in the movies or tv shows just asking since I like computers.
Posted
by Macri007.
Last updated
.
Post not yet marked as solved
2 Replies
193 Views
Hello everyone. I'm try to get out of verifyReceipt endpoint by following this link https://developer.apple.com/videos/play/wwdc2023/10143/ at the end of video so after using ReceiptUtility extract receipt data to get transationId then using getTransactionHistory to do what? it doesn't clear in the video. Where I can get document on how to verify receipt with AppStoreServerAPI.
Posted
by hungkodak.
Last updated
.
Post not yet marked as solved
1 Replies
205 Views
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.
Posted
by hungkodak.
Last updated
.
Post not yet marked as solved
1 Replies
277 Views
Hi, Starting this weekend our backend fails to connect to the production Apple verifyReceipt endpoint. It's a C# .NET service running on windows server. The full exception received is: Exception: "The underlying connection was closed: An unexpected error occurred on a send". Inner Exception: "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host". Is someone else facing a similar issue? sending a request to the Apple production verifyReceipt URL via Postman (located on the same server) succeeds. Thanks in advance...
Posted Last updated
.
Post not yet marked as solved
2 Replies
425 Views
I have an app in which there are two different subscription groups and One non-consumable product. User can have two(2) subscriptions and one non-consumable purchase [total three purchases] at a time. All three have different "originalTransactionIdentifier". How can i get user's purchase History in ONE App store server API request?
Posted
by israr786.
Last updated
.
Post not yet marked as solved
0 Replies
424 Views
Since verifyReceipt is marked as deprecated, there is appstore server library; e.g. this is the java version: https://github.com/apple/app-store-server-library-java/tree/main According to https://developer.apple.com/videos/play/wwdc2023/10143/, client (game) sends receipt to server for validation and server extracts transactionId with ReceiptUtility and asks for transaction history to appstore to receive signed transactions. During this request, server can filter to receive only consumables; e.g: TransactionHistoryRequest request = new TransactionHistoryRequest() .sort(TransactionHistoryRequest.Order.DESCENDING) .revoked(false) .productTypes(List.of( TransactionHistoryRequest.ProductType.CONSUMABLE)); Working in sanbox env, everything seems fine, I can make a successful in app purchase; but I receive below from transaction history request: APIException{httpStatusCode=404, apiError=4040010, apiErrorMessage='Transaction id not found.'} But when I use getTransactionInfo with the same extracted transactionId, I receive a successful response like below: TransactionInfoResponse{signedTransactionInfo='eyJ.... I have 2 questions here: 1- why am i getting error in TransactionHistoryRequest 2- what is the correct way to validate an in app purchase server side without verifyReceipt? Thanks in advance PS: Here are sample codes for TransactionHistoryRequest and getTransactionInfo: TransactionHistoryRequest String encodedKey = Files.readString(filePath); Environment environment = Environment.SANDBOX; AppStoreServerAPIClient client = new AppStoreServerAPIClient(encodedKey, keyId, issuerId, bundleId, environment); String receipt = "MIIUW......"; ReceiptUtility receiptUtil = new ReceiptUtility(); String transactionId = receiptUtil.extractTransactionIdFromAppReceipt(receipt); System.out.println("extracted txId is " + transactionId); if (transactionId != null) { TransactionHistoryRequest request = new TransactionHistoryRequest() .sort(TransactionHistoryRequest.Order.DESCENDING) .revoked(false) .productTypes(List.of(TransactionHistoryRequest.ProductType.CONSUMABLE)); HistoryResponse response = null; List<String> transactions = new LinkedList<>(); do { String revision = response != null ? response.getRevision() : null; System.out.println("revision is " + revision); response = client.getTransactionHistory(transactionId, revision, request); transactions.addAll(response.getSignedTransactions()); } while (response.getHasMore()); System.out.println(transactions); } getTransactionInfo String encodedKey = Files.readString(filePath); System.out.println("encoded key is " + encodedKey); String receipt = "MIIUW..."; ReceiptUtility receiptUtil = new ReceiptUtility(); String txId = receiptUtil.extractTransactionIdFromAppReceipt(receipt); Environment environment = Environment.SANDBOX; AppStoreServerAPIClient client = new AppStoreServerAPIClient(encodedKey, keyId, issuerId, bundleId, environment); try { TransactionInfoResponse response = client.getTransactionInfo(txId); String signed = response.getSignedTransactionInfo(); System.out.println(">>>" + signed.split("\\.").length); String jws_payload = signed.split("\\.")[1]; String payload = new String(Base64.decodeBase64(jws_payload)); System.out.println(response); System.out.println("payload is " + payload); } catch (APIException | IOException e) { e.printStackTrace(); }
Posted Last updated
.
Post not yet marked as solved
1 Replies
537 Views
Hello With V1 notifications, all you had to do was check status 21007 in production to switch to sandbox, but with V2 how do you do that? At best you get a 401 if you query production with a sandbox transactionID. How can I ensure that transaction validation via AppStore Server uses the correct environment during the Apple review? What is the procedure for V2 notifications and Apple review? If my code deployed in production is on the product environment, what happens at review time? I don't think anyone on the web has asked this question... Any help would be appreciated Nicolas
Posted
by NicolasB.
Last updated
.
Post not yet marked as solved
1 Replies
536 Views
We are currently managing four root certificates. Checked the ChainVerifier class code in 'App Store Server Library'. I checked that the root certificate was excluded when I called the CertPathValidator.validate method. So the root certificate is not falsified? Is it okay if I don't even check my fingerprints?
Posted
by bisu.
Last updated
.
Post marked as solved
1 Replies
661 Views
We're able to successfully perform test notifications using the app-store-server-library-python in SANDBOX environment, but the second we switch to PRODUCTION (for testing purposes), the call fails with 401 and it doesn't seem to reach our server at all. This suggests that something is wrong with singing production environment headers, however I've seen posts from others that suggest this is not specific to the App Store server library code. It's very clear that the libraries are marked Beta – however, most replies to questions about the v2 API are replied to with suggestions to use the library. Just FWIW – there's some contradictory advice there. Anyway, the main point is that we're currently blocked on making sure that our v2 API hooks are working properly, since we can't send production test notifications. Any idea why the signed requests would work to send sandbox test notifications, but not production environment? We've triple checked the URLs, etc – as far as we know, the private key should be the same regardless of environment. Thanks! (P.S. If anyone has been able to send v2 test notifications with the PRODUCTION environment, please let us know!)
Posted Last updated
.
Post not yet marked as solved
1 Replies
731 Views
Is the Apple root certificate in the App Store Server API response always 'Apple Root CA - G3'? When isn't it? What criteria should I set for the 'performRevocationChecking' parameter value of the verifyChain method of the ChainVerifier class in the App Store Server Library? I am implementing the 'App Store Server API' call myself. Do you include the root certificate in the certificate chain verification process? Can root certificates be forged?
Posted
by bisu.
Last updated
.
Post not yet marked as solved
0 Replies
393 Views
1.We are making a request to Apple's GetTransactionInfo api: request_uri: GET https://api.storekit.itunes.apple.com/inApps/v1/transactions/570xxxxxx152928 request_response_body` :{"signedTransactionInfo":"eyJh....."} 2.Parse the signedTransactionInfo content returned by the GetTransactionInfo Api JWSTransactionDecodedPayload: { "appAccountToken": "FBACxxxx376", "bundleId": "com.test.xx", "currency": "VND", "environment": "Production", "inAppOwnershipType": "PURCHASED", "originalPurchaseDate": 1700369755000, "originalTransactionId": "57xxxxxx2928", "price": -1795967296, "productId": "com.text.xx9", "purchaseDate": 1700364444000, "quantity": 1, "signedDate": 1700364444000, "storefront": "VNM", "storefrontId": "123456", "transactionId": "57xxxxxx2928", "transactionReason": "PURCHASE", "type": "Consumable" } 3. The Apple Api returned an abnormal price: -1,795,967,296. Personal speculation: The original price of the current order item [com.text.xx9] is 2,499,000 VND, and the Apple Api multiplies the price amount by 1000, resulting in a final amount of 2,499,000,000. However, due to an overflow issue in the length of the price amount, the price in the order details becomes -1,795,967,296, a negative number. Appstore api doc: GetTransactionInfo Api docGet Transaction Info | Apple Developer Documentation JWSTransactionDecodedPayload doc:JWSTransactionDecodedPayload | Apple Developer Documentation
Posted Last updated
.
Post not yet marked as solved
0 Replies
441 Views
Dear Apple Developer Forum Community, I hope this message finds you well. We are in the process of planning a migration from the existing "verify receipt" method to the new App Store Server API using the app-store-server library in Node.js. While we are excited about the capabilities and advantages that the app-store-server library offers, we have noted that it is currently in a beta phase. As we strive to ensure a stable and reliable production environment for our application, we would like to inquire about the expected timeline for the app-store-server library to transition from beta to a production-ready release. Our decision to adopt this library is contingent upon its readiness for production use, and we are keen to align our migration plans with its development roadmap. Any insights or updates regarding the library's readiness for production use would be greatly appreciated. Thank you for your time and assistance. We look forward to your response and are eager to continue our journey of providing exceptional experiences to our users through the Apple ecosystem. Sincerely,
Posted
by ParthOpt.
Last updated
.
Post not yet marked as solved
2 Replies
595 Views
verifyReceipt is providing strange results lately in the sandbox environment. Instead of returning the expiration time of the latest receipt in returns something from the past The [pending_renewal_info] returns multiple entries and none of them are for the current receipt Any one experiencing the same issues?
Posted Last updated
.
Post marked as solved
2 Replies
832 Views
Receipt verification on my app's server suddenly started giving an error, and all billing-related processes became errors. The error that is occurring is Signature verification failed is.(FireBaseJWT throw Exception) The code is below, but it was working fine until 3 days ago. JWT::decode($lastTransaction['signedTransactionInfo'], $appleCertificate, ['ES256']); The certificate used here was created by the server developer, so I don't know how to create it. Could you please help me which certificate should I use? I tried using the ApplePKI certificate, but the same error occurred. 私のアプリのサーバでのレシート検証が突然エラーを吐くようになり、課金関連の処理が全てエラーになってしまいました。 発生しているエラーはSignature verification failedです。(FireBaseJWTのException) コードは以下になっていますが、3日前までは正常に動作していたコードです。 JWT::decode($lastTransaction['signedTransactionInfo'], $appleCertificate, ['ES256']); ここで利用している証明書はサーバ開発者に作成して貰っていたので作成方法が分かりません。 どの証明書を使えば良いか助けて貰えないでしょうか。 ApplePKIの証明書は粗方試してみましたが同様のエラーになっています。
Posted
by kamata.
Last updated
.
Post not yet marked as solved
0 Replies
568 Views
Have been trying to Download iOS 17.0 Simulator for the last six hours. Using Activity Monitor to determine the speed to the Download. One time, Downloads window indicated 99% had been reached. It appears the Apple server connection may be unreliable? So what would be your User Experience?
Posted Last updated
.
Post not yet marked as solved
0 Replies
626 Views
Hi, our App client now uses the StoreKit Original API to implement In-App Purchase. Now we want to upgrade to using StoreKit 2 for iOS15 and above. Here's our plan: For clients running iOS versions lower than 15, we intend to continue using the transactionReceipt interface.To reduce the workload, we plan to skip the version of getting receipts using appStoreReceiptURL. Clients using iOS 15 and newer versions will employ StoreKit 2's interfaces to get transactions. The client sends receipts or transactions to the backend, where the backend use the transaction info API to verify the transactions. I would like to inquire if this approach seems reasonable.And if there's a possibility that the transactionReceipt function within the StoreKit Original API could become entirely unusable in the next two to three years (for example, the transactionReceipt interface call fails or returns null).
Posted Last updated
.
Post marked as solved
3 Replies
784 Views
Hi, I’m investigating switching from the /verifyReceipt endpoint to the App Store Server API. I’ve noticed that some transaction IDs we have in our system return 4040001 (AccountNotFound) from the “Get All Subscription Statuses” endpoint. These transaction IDs are associated with receipts that used to verify OK with the /verifyReceipt endpoint, but now return 21010 (receipt unauthorized). Under what circumstances do transactions which used to be valid start returning “account not found”?
Posted
by willft.
Last updated
.
Post marked as solved
9 Replies
1.1k Views
Currently, my app validates App Store receipts on the device, so as per this news, I need to make changes to it, But I am unable to make a decision on where I should start, Can anyone please help me out on this? Do I need to make changes in the device receipt validation? If yes, what steps should I take? OR Should I do the receipt validation from the server side? If yes, then what steps to follow to make a receipt validation on the server? Your suggestions will be highly appreciated.
Posted Last updated
.