App Store Server Notifications

RSS for tag

Monitor subscription events in real time with server notifications from the App Store using App Store Server Notifications.

App Store Server Notifications Documentation

Posts under App Store Server Notifications tag

95 Posts
Sort by:
Post not yet marked as solved
0 Replies
386 Views
I am using StoreKit2 to offer an auto-renewable subscription in an iOS app, and have observed inconsistent results from the currentEntitlement function during sandbox testing To illustrate the issue I have created a function which prints out a timestamped entitlement, as well as subscription status using the following code. @MainActor func printSubscriptionInfo() async { let productId = "com.mycompany.autorenewablesubscription.subscription.id" print() print(Date.now) // Current entitlement if let currentEntitlement = await Transaction.currentEntitlement(for: productId) { if case .verified(let transaction) = currentEntitlement { print("Purchase date: \(transaction.purchaseDate)") print("Expiry date: \(transaction.expirationDate!)") } else { print("Transaction not verified") } } else { print("No entitlement for \(productId)") } // Subscription information let product = (availableProducts.filter { $0.id == productId }).first! guard let statuses = try? await product.subscription?.status, let status = statuses.first else { print("Unable to get subscription status") return } print("Subscription status: \(status.stateDescription)") } The following shows the output of this function at various time points after a purchase, as well as the associated server notifications received. Purchase completed: at 12:23:20 Function output at 12:23:40: Purchase date: 12:23:09 Expiry date: 12:26:09 Subscription status: subscribed Server notifications: 12:23:13 - INTERACTIVE_RENEWAL 12:25:20 - INITIAL_BUY Function output at 12:26:18: No entitlement for com.mycompany.autorenewablesubscription.subscription.id Subscription status: subscribed Server notifications: 12:28:26 - INITIAL_BUY Function output at 12:31:03 Purchase date: 12:29:09 Expiry date: 12:32:09 Subscription status: subscribed The output of the function called after the first subscription renewal (ie at 12:26:09) shows no current entitlement, even though the subscription status is correct and there are no server notifications indicating expiry. After the next expiry period has passed, the function returns correct results once more. Has anyone else noticed this behaviour?
Posted
by
Post not yet marked as solved
0 Replies
302 Views
Hi , Our server received a notification from Apple with type of "CONSUMPTION_REQUEST". According to Send Consumption Information we generated response which include JWT token in the header and ConsumptionRequest Response was send as: PUT https://api.storekit.itunes.apple.com/inApps/v1/transactions/consumption/ {transaction id} Response wasn't any of the Response Codes ( 202,400,401,404 or 500) , but "Empty reply from server" What mean "Empty reply from server" and what is the problem with sending consumption request ? Thank you in advance for any help.
Posted
by
Post not yet marked as solved
0 Replies
291 Views
First I want to say that adding the possibility to send Sandbox notifications to a separate test environment is something we have expected for a long time. Our test environment is behind a firewall that is restricted against outside connections. Is there a specific host/IP for the push service we could whitelist on our side to get the Sandbox notifications successfully sent?
Posted
by
Post not yet marked as solved
3 Replies
1.9k Views
I have started implementing support for the new App Store Server notifications (version 2): https://developer.apple.com/documentation/appstoreservernotifications/receiving_app_store_server_notifications I am not sure how to prevent a possible mad-in-the-middle attack when using those notifications. The decoded header that I get for notifications in the Sandbox environment is missing the "kid" field that is used to identify the key used to generate a signature. Yes, I understand the the whole entire certificate chain is available in the "x5c" field and it could be verified by itself. However, this does not guarantee that a notification was signed by Apple. This approach (with no specific key, with a certificate chain in x5c) works fine when verifying a receipt on device with StoreKit 2 but it does not work when getting a notification on a server.
Posted
by
Post not yet marked as solved
0 Replies
375 Views
Hi, When receiving provisional user notifications in iOS 15 the "Turn Off..." button works fine, but the "Keep..." button doesn't save the settings. "Deliver Immediately" option doesn't do anything and "Deliver in Scheduled Summary" hides the buttons, but they appear again in next notification. I've noticed this behavior with several different apps, for example Reddit. Does anyone know anything about this? I have also submitted a bug to Apple but no response so far. select Deliver Immediately can not save , my select , nextTime has new notification , let me select Deliver Immediately or Deliver in Scheduled Summary again . xcode 13.1 iphone 15.1
Posted
by
Post not yet marked as solved
0 Replies
421 Views
For a new app, I have configured my server and the app in App Store Connect according to the official documentation: https://developer.apple.com/documentation/appstoreservernotifications/enabling_app_store_server_notifications https://help.apple.com/app-store-connect/#/dev0067a330b However, for some reason I am not receiving any notifications at all, although I have created several subscriptions, up-/downgraded, cancelled, resubscribed, switched auto-renew on and off, aso. I also have access logs and even there I don't see any call from Apple. A simple test using curl, however, does work as expected: $ curl -v 'https://MY_HOST/apple-s2s/app-store/sandbox' --data-binary '{}' --header 'content-type: application/json' *   Trying my...ip:443... * Connected to MY_HOST (my...ip) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * successfully set certificate verify locations: *  CAfile: /etc/ssl/certs/ca-certificates.crt *  CApath: /etc/ssl/certs * TLSv1.3 (OUT), TLS handshake, Client hello (1): * TLSv1.3 (IN), TLS handshake, Server hello (2): * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): * TLSv1.3 (IN), TLS handshake, Certificate (11): * TLSv1.3 (IN), TLS handshake, CERT verify (15): * TLSv1.3 (IN), TLS handshake, Finished (20): * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): * TLSv1.3 (OUT), TLS handshake, Finished (20): * SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256 * ALPN, server accepted to use h2 * Server certificate: *  subject: CN=MY_HOST *  start date: Nov 16 19:10:49 2021 GMT *  expire date: Feb 14 19:10:48 2022 GMT *  subjectAltName: host "MY_HOST" matched cert's "MY_HOST" *  issuer: C=US; O=Let's Encrypt; CN=R3 *  SSL certificate verify ok. * Using HTTP2, server supports multi-use * Connection state changed (HTTP/2 confirmed) * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0 * Using Stream ID: 1 (easy handle 0x55dc1f20eb10) > POST /apple-s2s/app-store/sandbox HTTP/2 > Host: MY_HOST > user-agent: curl/7.74.0 > accept: */* > content-type: application/json > content-length: 2 >   * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * We are completely uploaded and fine * Connection state changed (MAX_CONCURRENT_STREAMS == 250)! < HTTP/2 200   < content-type: application/json < date: Tue, 23 Nov 2021 19:41:35 GMT < server: nginx/1.21.0 < content-length: 2 <   * Connection #0 to host MY_HOST left intact {} There is also nothing from within the App Store Connect where I could see that something went wrong, whether Apple actually tried to connect at all or whether I am missing to configure anything else. No feedback at all here, very sad.
Posted
by
Post not yet marked as solved
2 Replies
411 Views
Hi, I'm working on an app that offers auto-renewable subscriptions on a monthly and yearly basis. The app (or the App Store Server Notification) sends the receipt to our trusted server which validates the receipts against https://buy.itunes.apple.com/verifyReceipt We are able to validate first purchases and renewals by field latest_receipt_info which contains an array with all the purchase transactions. However, when a user upgrades their monthly subscription to a yearly one, the array latest_receipt_info doesn't contain the new subscription (the yearly one). The yearly subscription appears in the array pending_renewal_info which doesn't contain the expiration_date or other fields required for updating our internal database. We also tried to restore the purchase and validate the new receipt again but the yearly subscription never appears in latest_receipt_info and always stays in pending_renewal_info. How can I validate upgrades to yearly subscriptions? why doesn't it appear in latest_receipt_info? Response from https://buy.itunes.apple.com/verifyReceipt by using the receipt sent by the App Store Server Notifications: { "environment": "Production", "receipt": { "receipt_type": "Production", "adam_id": 987654321, "app_item_id": 987654321, "bundle_id": "com.company.productcompany", "application_version": "1221", "download_id": 5000000000000000000, "version_external_identifier": 800000000, "receipt_creation_date": "2021-11-26 09:39:12 Etc/GMT", "receipt_creation_date_ms": "1637919552000", "receipt_creation_date_pst": "2021-11-26 01:39:12 America/Los_Angeles", "request_date": "2021-11-26 10:11:09 Etc/GMT", "request_date_ms": "1637921469566", "request_date_pst": "2021-11-26 02:11:09 America/Los_Angeles", "original_purchase_date": "2021-11-17 13:50:18 Etc/GMT", "original_purchase_date_ms": "1637157018000", "original_purchase_date_pst": "2021-11-17 05:50:18 America/Los_Angeles", "original_application_version": "1219", "in_app": [ { "quantity": "1", "product_id": "com.company.product.subs1.onemonth", "transaction_id": "150000000000000", "original_transaction_id": "150000000000000", "purchase_date": "2021-11-25 09:29:50 Etc/GMT", "purchase_date_ms": "1637832590000", "purchase_date_pst": "2021-11-25 01:29:50 America/Los_Angeles", "original_purchase_date": "2021-11-25 09:29:50 Etc/GMT", "original_purchase_date_ms": "1637832590000", "original_purchase_date_pst": "2021-11-25 01:29:50 America/Los_Angeles", "expires_date": "2021-12-25 09:29:50 Etc/GMT", "expires_date_ms": "1640424590000", "expires_date_pst": "2021-12-25 01:29:50 America/Los_Angeles", "web_order_line_item_id": "150000419389034", "is_trial_period": "false", "is_in_intro_offer_period": "false", "in_app_ownership_type": "PURCHASED" } ] }, "latest_receipt_info": [ { "quantity": "1", "product_id": "com.company.product.subs1.onemonth", "transaction_id": "150000000000000", "original_transaction_id": "150000000000000", "purchase_date": "2021-11-25 09:29:50 Etc/GMT", "purchase_date_ms": "1637832590000", "purchase_date_pst": "2021-11-25 01:29:50 America/Los_Angeles", "original_purchase_date": "2021-11-25 09:29:50 Etc/GMT", "original_purchase_date_ms": "1637832590000", "original_purchase_date_pst": "2021-11-25 01:29:50 America/Los_Angeles", "expires_date": "2021-12-25 09:29:50 Etc/GMT", "expires_date_ms": "1640424590000", "expires_date_pst": "2021-12-25 01:29:50 America/Los_Angeles", "web_order_line_item_id": "150000419389034", "is_trial_period": "false", "is_in_intro_offer_period": "false", "in_app_ownership_type": "PURCHASED", "subscription_group_identifier": "19900000" } ], "latest_receipt": "MII...Mk6fIA3", "pending_renewal_info": [ { "auto_renew_product_id": "com.company.product.subs1.twelvemonths", "product_id": "com.company.product.subs1.onemonth", "original_transaction_id": "150000000000000", "auto_renew_status": "1" } ], "status": 0 }
Posted
by
Post not yet marked as solved
1 Replies
397 Views
Hi, I want to implement in app purchase for my app. On our server, we set it up to be able to receive https requests. And if I call from postman, it is able to respond and server will log some data. However, when I subscribe and cacnel subscription from the ios app using sandbox user, the server never receive any update although I already set up the URL in Sandbox Server URL. Is there anyway that I could check whether apple has send out the notification so that I know where the problem happens?
Posted
by
Post not yet marked as solved
0 Replies
173 Views
Hey Team, we're seeing a sudden dip in our retention on the app store connect dashboard. For the last 8 mo's it always remain ~90% retention (paid users --> paid to continue) but now we're seeing it to be ~16%. Is anyone else also facing the same thing or do you know what can be the potential reason for the same? PS: we launched a new tier in the same subs group on ~3rd Dec but seeing an impact from the last few days only.
Posted
by
Post marked as solved
1 Replies
324 Views
Hello! I want to parse json, which you send in notifications v2, but have some questions about required and optional fields (actually I may do all the fields, which are non obvious for me optional, but that's not suitable). It would be really amazing if you will update your docs with this info! And it would be cool if you'll add some examples of the whole notification structure (it would be more convinient) with different types (and refer to example for concrete field like here is "revocationDate", it appears in case of "REVOKE" event and may be found here: <example reference> - it would be perfect!) Main questions are: does signedRenewalInfo always appear here or it doesn't if it's consumable notification? does bundleId either always appear or it may not if it is deleted somewhere somehow? do i understand right that "empty subtype" doesn't mean empty string but means absence of field in json? does autoRenewStatus always appear here or it may be absent? do purchaseDate and originalPurchaseDate from here always appear or there are some cases (revocation maybe) when they may be missed? does transactionId field always appear or there are some exceptions (revocation?)? does inAppOwnershipType from here always appear? is quantity (from the same struct) required field? is webOrderLineItemId (from the same struct) a required field?
Posted
by
Post marked as solved
1 Replies
276 Views
Thank you for your help! In v1 of app store servernotifications, there was a notificationType, CANCEL, but it is gone from v2. In v1 of the app store servernotifications, there was a notificationType of CANCEL, but in v2 it's gone. Which notification should I use instead when CANCEL happens? v1 notificationType Document Link https://developer.apple.com/documentation/appstoreservernotifications/notification_type v2 notificationType Document Link https://developer.apple.com/documentation/appstoreservernotifications/notificationtype?changes=la
Posted
by
Post not yet marked as solved
1 Replies
180 Views
After purchasing an annual product package, the apple server notification interval is once an hour, and the user is not charged, while the transactionId is different for each notification. The app is an official environment and has been audited, can anyone help me? Thank you!
Posted
by
Post not yet marked as solved
1 Replies
455 Views
We are thinking about moving to the new V2 App Store Server Notifications for our existing app. I have the following question. My understanding is that our app needs to have support for iOS 15 and store kit 2 in order to receive the V2 notifications. So, what happens if we have users that are still using our app on a lower iOS version like iOS 14, will we get notifications for those users and will they be in v1 or v2 format? Essentially, do we need to support both v1 and v2 notifications until we get all of our users onto iOS 15?
Posted
by