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

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
App Store Server Notifications not always sent to my server
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).
8
7
2.4k
Oct ’23
When does AccountNotFound get returned from "Get All Subscription Statuses"?
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”?
3
0
964
Aug ’23
Get custom codes used in transaction receipt (renewable subscription)
Issue Currently I have multiple subscription offers available for yearly/monthly subscriptions. Each of the subscription offers have multiple different custom codes available. When the customer buys a subscription and the receipt is being handled in the backend, I need to know which of the custom codes was used. What I have tried When i call the https://buy.itunes.apple.com/verifyReceipt I get the values offer_code_ref_name and promotional_offer_id. The offer_code_ref_name is the subscription offer name AND NOT the custom code. I tried to get more info using the https://api.storekit.itunes.apple.com/inApps/v1/subscriptions/{transactionId} request, but it does not give me any info about the custom code used either. I do however see which custom code has been used if I go to Sales and Trends > Sales and Trends Reports and download Subscritpion Reports. There the offer code can be found ref. as "Promotional Offer ID" my question How can I get which custom code was used when purchasing a renewable subscription using transaction id or transaction Receipt?
1
0
486
Aug ’23
Is there any status code indicate that transactionId is from sandbox?
In the old verifyReceipt endpoint doc, there is an important desc As a best practice, always call the production URL https://buy.itunes.apple.com/verifyReceipt first and proceed to verify with the sandbox URL if you receive a 21007 status code. Following this approach ensures that you don’t have to switch between URLs while your app is in testing, in review by App Review, or live in the App Store. So I can know the transactionId is for sandbox if return back 21007. And I am about to access to new App Store Server API, so the same, I wonder how can I recognize the transactionId is from sandbox by status code? The most likely desc is this: If you don’t have environment information, follow these steps: Call the endpoint using the production URL. If the call succeeds, the original transaction identifier belongs to the production environment. If you receive an [errorCode 4040005] with errorMessage as OriginalTransactionIdNotFoundError, (or HTTP response code 404 from the Send Consumption Information endpoint), call the endpoint using the sandbox environment. If the call succeeds, the original transaction identifier belongs to the sandbox environment. If the call fails with the same error code, the original transaction identifier isn’t present in either environment. And I have a try for Get Transaction Info API, but actually get 4040010, Transaction id not found. as return. So I just wanna clear that is there any doc clarify this point that I miss? Looking forward to your response, sincerely!! :)
1
0
1.5k
Sep ’23
Not Receiving Server Notifications for Auto-Renewable Notifications when in free trial phase
Hi, we have an auto-renewable subscription with an introductory offer configured. The introductory offer is a 7 days free trial. We're observing a possibly wrong behavior and we wanted to make sure we're not missing anything. We suspect that our server is not receiving notifications from the App Store when the free trial period starts, we only receive notifications when the user starts paying. To double-check, we've tested the same subscription in sandbox with a brand new test account with a 3 minutes renewal frequency: the behavior is exactly the same, we only get 1 notification every 3 minutes for the renewals, we get no notification when the free trial starts. So we have 2 main questions: does "free trial" work in sandbox too? If so, what's the duration of free trial in sandbox if it's set to 7 days in production? do we get a notification when the free trial period starts or we only get one when and if the user starts paying after 7 days? Thanks
1
0
957
Aug ’23
Why Non-Consumable product has originalTransactionId?
I try to call Get Transaction Info from App Store Server API, and the transactionId is for a Non-consumable type product, but it is odd that there are so many different transactionId and they have a same originalTransactionId { "bundleId": "${bundleId}", "environment": "Production", "inAppOwnershipType": "PURCHASED", "originalPurchaseDate": 1691220528000, "originalTransactionId": "${originalTransactionId}", "productId": "${productId}", "purchaseDate": 1691220528000, "quantity": 1, "signedDate": 1692590989925, "storefront": "USA", "storefrontId": "143441", "transactionId": "${originalTransactionId}", "transactionReason": "PURCHASE", "type": "Non-Consumable" } the defination of Non-Consumable is can only purchase once for same apple account. But why there would have originalTransactionId?
1
0
635
Aug ’23
How to guarantee that user won't be able to makeup transaction_id to call new api
If my user purchase and get transaction_id: 2000000395609292, and then another user just makeup a same transaction_id to call the App Store Server API If in the old way, the receipt seems impossiable to makeup, how about now? Is that equally safe as before? Or is there any way to protect transaction_id. I am not that good at security, so please forgive me about missing any point. o(╥﹏╥)o Looking forward to your response, sincerely!! :)
3
0
572
Aug ’23
There are some field describe missing sth in App Store Server Api
here are some field in JWSTransactionDecodedPayload and JWSRenewalInfoDecodedPayload, miss this kind of desc: This field is present only for xxxxx Such as revocationReason in JWSTransactionDecodedPayload, this field is present only when transaction is refunded. And its possible value is 0 and 1, when this field not present, golang would still unmarshal to default 0 for int32 type isInBillingRetryPeriod in JWSRenewalInfoDecodedPayload, this field is present only when transaction in billing-retry state(relative doc), and because this field type is boolean, so possible value is true and false, base on the old api desc, true - The App Store is attempting to renew the subscription. false - The App Store has stopped attempting to renew the subscription. When this field not present, golang would still unmarshal to default false for bool type priceIncreaseStatus in JWSRenewalInfoDecodedPayload, this field is present only when an auto-renewable subscription price increase that requires customer consent. Its possible value is 0 - The customer hasn’t yet responded to an auto-renewable subscription price increase that requires customer consent. 1 - The customer consented to an auto-renewable subscription price increase that requires customer consent, or the App Store has notified the customer of an auto-renewable subscription price increase that doesn’t require consent.
0
0
457
Aug ’23
many questions about App Store Server API
Hello, I have a few questions about the App Store Server API. According to the document, if 'OriginalTransactionIdNotFoundError(errorCode: 4040005)' is received as a response after calling the production environment API if there is no environment information, it is written to call the sandbox environment, but 'Get Transaction Info' / 'Get Transaction History' API call and when 'TransactionIdNotFoundError(errorCode: 4040010)' is received, can I call it in the sandbox environment? Is the root certificate of the X.509 certificate chain on x5c claim in JWSDecodedHeader always AppleRootCA-G3? If I add and recall the query parameter '?sort=DESCENDING' in the Get Transaction History API, will the first transaction information always have the largest expiration date?
0
0
529
Aug ’23
How to Determine Trial-Related Information Using App Store Server API
As we transition from using verifyReceipt to the App Store Server API, I'd like to know how we can determine trial-related information such as is_trial_period and is_in_intro_offer_period. Specifically, can we differentiate these details using the offerType value (https://developer.apple.com/documentation/appstoreserverapi/offertype)? Any guidance or suggestions would be greatly appreciated. Thank you.
0
0
390
Aug ’23
No REFUND notification in sandbox
I have verified that my sandbox endpoint works for App Store Server Notifications (V2), by requesting a Test Notification. When I issue a beginRefundRequest in my app for a Sandbox account, my backend does not receive a request. According to the docs this should work in Sandbox too: https://developer.apple.com/documentation/storekit/transaction/testing_refund_requests What could possible be missing if the TEST notification works, but the REFUND notification doesn't?
1
0
547
Sep ’23
JWT for App Store Server API requests
Hello, I'm trying to generate a JWT in C# for calling this endpoint -> https://developer.apple.com/documentation/appstoreserverapi/look_up_order_id I have followed the instructions in the documentation, but I'm always getting "Unauthenticated" as a response. The private key used is of type "In-App Purchase" as the documentation says. Here you have a response with a Request ID: Unauthenticated Request ID: YGV3ELXFCFHA5IPRZEW76S66NQ.0.0 This is the code used to generate the JWT: public string CreateNewApiToken() { const string audience = "appstoreconnect-v1"; var kid = "***"; var privateKey = "***"; var bundleId = "***"; var issuerId = "***"; var now = DateTime.UtcNow; using var ecdsa = ECDsa.Create(); ecdsa?.ImportPkcs8PrivateKey(Convert.FromBase64String(privateKey), out _); var signingCredentials = new SigningCredentials(new ECDsaSecurityKey(ecdsa), SecurityAlgorithms.EcdsaSha256); signingCredentials.Key.KeyId = kid; var payload = new JObject { { "iss", issuerId }, { "iat", now.ToUnixTime() }, { "exp", now.AddMinutes(30).ToUnixTime() }, { "aud", audience }, { "bid", bundleId} }; var handler = new JsonWebTokenHandler(); var token = handler.CreateToken(payload.ToJson(), signingCredentials); return token; } Thanks in advance.
2
0
877
Sep ’23
How to decode signedTransactionInfo after GET request?
Hello! Please let me know after I make a request for purchase information GET https://api.storekit-sandbox.itunes.apple.com/inApps/v1/transactions/2000000411047647 I receive encrypted information in this format { "signedTransactionInfo":"eyJhbGciOiJFUzI1NiIsIng1YyI6WyJNSUlFTURDQ0E3YWdBd0lCQWdJUWZUbGZkMGZOdkZXdnpDMVlJQU5zWGpBS0JnZ3Foa2pPUFFRREF6QjFNVVF3UWdZRFZRUURERHRCY0hCc1pTQlhiM0pzWkhkcFpHVWdSR1YyWld4dmNHVnlJRkpsYkdGMGFXOXVjeUJEWlhKMGFXWnBZMkYwYVc5dUlFRjFkR2h2Y21sMGVURUxNQWtHQTFVRUN3d0N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UExnaExMSndBdjVKOGhCR0xhSThERXhkY1BYK2FCS2pqTzhlVW85S3BmcGNOWVVZNVlBakFQWG1NWEVaTCtRMDJhZHJtbXNoTnh6M05uS20rb3VRd1U3dkJUbjBMdmxNN3ZwczJZc2xWVGFtUllMNGFTczVrPSIsIk1JSURGakNDQXB5Z0F3SUJBZ0lVSXNHaFJ3cDBjMm52VTRZU3ljYWZQVGp6Yk5jd0NnWUlLb1pJemowRUF3TXdaekViTUJrR0ExVRWUVFERER0QmNIQnNaU0JYYjNKc1pIZHBaR1VnUkdWMlpXeHZjR1Z5SUZKbGJHRj000OUJBTURBMmdBTUdVQ01RQ0Q2Y0hFRmw0YVhUUVkyZTN2OUd3T0FFWkx1***5UmhIRkQvM21lb3locG12T3dnUFVuUFdUeG5TNGF0K3FJeFVDTUcxbWloREsxQ" } Please tell me how I can decode the information signedTransactionInfo ? and what is needed for this? (I'm trying to decode on Node.js)
4
0
2.2k
Feb ’24