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

103 Posts
Sort by:
Post not yet marked as solved
5 Replies
2.8k Views
How do we find out User information from Apple server notifications? I have created a user and purchased an In app product from Apple . I have received a INITIALBUY notification from the App store. Apple ID : xxxx@gmail.com User : ABC (User id :111) The JSON receipt contains the following fields. "latestreceiptinfo": { "transactionid": "1000000657540200", "originaltransactionid": "1000000657537943", "quantity": "1", "subscriptiongroupidentifier": "20623048", "isinintroofferperiod": "false", "purchasedatepst": "2020-04-27 23:41:05 America/LosAngeles", "istrialperiod": "false", "expiresdateformattedpst": "2020-04-27 23:46:05 America/LosAngeles", "productid": "com.***.iap1.5", "weborderlineitemid": "1000000052078939", "uniquevendoridentifier": "xxxxxx-xxxxxxx" }, I have created one more user  from the same Apple id and purchased the same product. Apple ID : xxxx@gmail.com User : XYZ (User id :222)   "latestreceiptinfo": { "transactionid": "1000000657540202", "originaltransactionid": "1000000657537943",    "productid": "com.***.iap1.5", "weborderlineitemid": "1000000052078942", "uniquevendoridentifier": "xxxxxx-xxxxxxx" },   I have store user information based on productid-  originaltransaction_id =>user  xxxx@gmail.com -  com.***.iap1.5 - 1000000657537943 -ABC xxxx@gmail.com - com.***.iap1.5 -  1000000657537943 -XYZ In this case I could not track the user information.Duplication will come From the same Apple id ,2 different users buy the same product Apple will give the same original transaction Id. Is there any other field to differentiate transactions to find users ? Is there any option to include User name on JSON server notification from App store.
Posted
by
Post not yet marked as solved
8 Replies
5.5k Views
Hi, Sometimes I get tons of errors 21104 and 21107 in a row when I try to validate new subscriptions and renew existing subscriptions from our server side by using the endpoint verifyReceipt: POST https://buy.itunes.apple.com/verifyReceipt https://developer.apple.com/documentation/appstorereceipts/verifyreceipt The response of this endpoint doesn't give any extra information: { 		"environment": "Production", 		"status": 21107, 		"is_retryable": true } I noticed that those subscriptions are renewed on the second try after waiting a bit (in a different hour/day). The documentation only indicates that the status codes 21100-21199 are internal data access errors but it doesn't specify each one: https://developer.apple.com/documentation/appstorereceipts/status I understand that it's an error on the Apple side so there is nothing I can do but if someone could give us more information about those errors (21104 and 21107).
Posted
by
Post not yet marked as solved
5 Replies
7.4k 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 marked as solved
2 Replies
847 Views
The notification webhook is marketed as a way to get server-side updates on changes to in-app subscriptions. In the normal case, you can use that information to know the current state of a subscription. However, the retry system means that a notification may come up to 72hrs after the actual state change occurred and that also means that notification may be out-dated (another state change occurred between the time it was intended to be sent and the time it actually got successfully sent). How are we supposed to ensure that a received notification is the current state of a subscription? Can we used the signedDate to determine the order of notifications? (ie. when a notification fails to be sent and is resent, is the signedDate not altered so it can be used to order the notifications?) Or do we need to always make a request to the /inApps/v1/subscriptions/ endpoint to get the latest state and not rely on the contents of the notification?
Posted
by
Post not yet marked as solved
3 Replies
1.4k Views
HI. After changing notifications v2 We received "REFUND_DECLINED" notifications But, we didn't do anything about refund. Also, we didn't send consumption information. Below is description of "REFUND_DECLINED" REFUND_DECLINED Indicates that the App Store declined a refund request initiated by the app developer. Can I know when we are getting this notification?
Posted
by
Post not yet marked as solved
6 Replies
1.5k Views
We have an App Store Server Notification endpoint. Our app offers an in app subscription. Most notifications have all of the expected fields, but in a small number of cases the decoded signedTransactionInfo and signedRenewalInfo fields are empty. I can't see anything about these fields being optional in the documentation, and without the transaction information I can't get the transaction id of the user, so I can't tell how this notification relates to others for the same original transaction id. Are these notifications expected? Should I be handling them in a special way? Or should I just ignore them? For example, a normal transaction will have the following fields: responseBodyV2DecodedPayload (     [notificationType] => DID_RENEW     [notificationUUID] => …     [version] => 2.0     [signedDate] => 1660947328849     [data] => (             [bundleId] => com.playpokpok.playroom             [bundleVersion] => 9             [environment] => Sandbox             [signedTransactionInfo] => JWSTransactionInfo             [signedRenewalInfo] => JWSRenewalInfo         ) ) But one of these unexpected requests will have the following form: responseBodyV2DecodedPayload (     [notificationType] => EXPIRED     [subtype] => VOLUNTARY     [notificationUUID] => …     [version] => 2.0     [signedDate] => 1662661854606     [data] => (             [appAppleId] => 1550204730             [bundleId] => com.playpokpok.playroom             [bundleVersion] => 6             [environment] => Production         ) )
Posted
by
Post not yet marked as solved
3 Replies
1.2k Views
In notification version1, there is an field called is_trial_period, is useful for us to identify this transaction is in free trial, and we can judge the user's payment status and recomand some feature for him. but, in notification version2 the filed is not appear, in this scenari, how can I identify this user is in free trial period ?
Posted
by
Post not yet marked as solved
1 Replies
876 Views
As per the display in "App Store Connect > Sales and Trends > Subscriptions > Summary", I'm wanting to understand how to calculate the 'Active paid subscriptions' figure for a particular period using only the subscription event data. This is for further analysis and calculation outside of App Store Connect. For example, if at the start of April I have 500 active paid subscriptions, then at the end of April I have 550 active paid subscriptions, what are the calculation of Subscription events that would make up this figure? I'd presume the formula would be: End of period subscriptions = start of period subscriptions + activations (includes trials) + conversions to standard price + reactivations - refunds - trial only activations - cancellations However when I compare the above calculation against what is reported by 'Active paid subscriptions' at the start and end of a period in App Store Connect it is not the same. What is the calculation of events across a period that determines the current 'Active paid subscriptions' figure?
Posted
by
Post not yet marked as solved
3 Replies
1.3k Views
Hi All, We are trying server-to-server notifications for in-app purchases. This is the first time we are configuring in-app purchases for the app, so configurations are still for test apps and in-app purchases being tested by sandbox accounts. For server-to-server notification, we configured the url as mentioned in the doc, but still, our server url is not being called after a successful in-app purchase. Could you please help if anything more is required for config?
Post not yet marked as solved
1 Replies
576 Views
I am writing to seek your assistance in resolving a problem I am facing with the server-to-server notification payload from the App Store. I have noticed that the certificate verification is failing when I receive the server-to-server notification payload. Upon investigation, I discovered that the payload contains expired certificates. This is causing an issue for me as it is preventing me from verifying trusted notifications from the App Store. I would greatly appreciate your guidance on what I should do to address this problem. Is there any way to renew the certificates or any other solution to resolve this issue? Thank you for your attention and I am looking forward to your prompt reply.
Posted
by
Post not yet marked as solved
1 Replies
566 Views
Hi everyone! I recently launched a hard paywall in my app and have had a fair few people each day sign up to the 3 day free trial. Around 55% of users remain after the 3 day trial but I am finding that when it ends around 20-25% of the users are running into 'billing errors' meaning they end up not paying at the end of the trial despite never cancelling. The information coming through from Apple ranges from 'insufficient credit', 'incorrect details' and 'unknown' - but the % is way higher than Has anyone come across this issue before at such a high % and if so, is there anything we can do to try and improve this number? Thank you!
Post marked as solved
7 Replies
2.0k 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
by
Post not yet marked as solved
2 Replies
780 Views
It is in sandbox environment, and our serice is using v1 Base on this doc, the INTERACTIVE_RENEWAL notification would be sent: Subscription is active; customer upgraded to another SKU Subscription has expired; customer resubscribed to another SKU (upgrade or downgrade) { "environment": "Sandbox", "receipt": { "receipt_type": "ProductionSandbox", "bundle_id": "co.appeconomy.alarm", "receipt_creation_date": "2023-04-26 10:13:24 Etc/GMT", "request_date": "2023-04-26 10:17:11 Etc/GMT", "original_purchase_date": "2013-08-01 07:00:00 Etc/GMT", "original_application_version": "1.0" }, "latest_receipt_info": [ { "quantity": "1", "product_id": "co.appeconomy.alarm.monthly", "transaction_id": "2000000320391970", "original_transaction_id": "2000000320390725", "purchase_date": "2023-04-26 10:11:53 Etc/GMT", "original_purchase_date": "2023-04-26 10:09:59 Etc/GMT", "expires_date": "2023-04-26 10:16:53 Etc/GMT", "web_order_line_item_id": "2000000026088214", "is_trial_period": "false", "is_in_intro_offer_period": "false", "in_app_ownership_type": "PURCHASED", "subscription_group_identifier": "20906883" }, { "quantity": "1", "product_id": "co.appeconomy.alarm.monthly", "transaction_id": "2000000320390725", "original_transaction_id": "2000000320390725", "purchase_date": "2023-04-26 10:09:53 Etc/GMT", "original_purchase_date": "2023-04-26 10:09:59 Etc/GMT", "expires_date": "2023-04-26 10:11:53 Etc/GMT", "web_order_line_item_id": "2000000026088213", "is_trial_period": "true", "is_in_intro_offer_period": "false", "in_app_ownership_type": "PURCHASED", "subscription_group_identifier": "20906883" } ], "pending_renewal_info": [ { "auto_renew_product_id": "co.appeconomy.alarm.monthly", "is_in_billing_retry_period": "0", "product_id": "co.appeconomy.alarm.monthly", "original_transaction_id": "2000000320390725", "auto_renew_status": "0" } ], "status": 0 } these is the response from verifyReceipt api Can notice that I request at '2023-04-26 10:17:11 Etc/GMT' and latest receipt shows that subscription is expired at '2023-04-26 10:16:53 Etc/GMT'. So obviously this subscription is expired already But when I resubscribed the same sku(in this case is co.appeconomy.alarm.monthly) in the Setting > App Store > Edit Subscription. My server can still receive INTERACTIVE_RENEWAL notification. { "bid": "co.appeconomy.alarm", "bvrs": "2", "environment": "Sandbox", "unified_receipt": { "status": 0, "environment": "Sandbox", "latest_receipt_info": [ { "quantity": "1", "product_id": "co.appeconomy.alarm.monthly", "expires_date": "2023-04-26 10:23:47 Etc/GMT", "purchase_date": "2023-04-26 10:18:47 Etc/GMT", "transaction_id": "2000000320398679", "is_trial_period": "false", "in_app_ownership_type": "PURCHASED", "web_order_line_item_id": "2000000026088350", "original_transaction_id": "2000000320390725", "is_in_intro_offer_period": "false", "subscription_group_identifier": "20906883" }, { "quantity": "1", "product_id": "co.appeconomy.alarm.monthly", "expires_date": "2023-04-26 10:16:53 Etc/GMT", "purchase_date": "2023-04-26 10:11:53 Etc/GMT", "transaction_id": "2000000320391970", "is_trial_period": "false", "in_app_ownership_type": "PURCHASED", "web_order_line_item_id": "2000000026088214", "original_transaction_id": "2000000320390725", "is_in_intro_offer_period": "false", "subscription_group_identifier": "20906883" }, { "quantity": "1", "product_id": "co.appeconomy.alarm.monthly", "expires_date": "2023-04-26 10:11:53 Etc/GMT", "purchase_date": "2023-04-26 10:09:53 Etc/GMT", "transaction_id": "2000000320390725", "is_trial_period": "true", "in_app_ownership_type": "PURCHASED", "web_order_line_item_id": "2000000026088213", "original_transaction_id": "2000000320390725", "is_in_intro_offer_period": "false", "subscription_group_identifier": "20906883" } ], "pending_renewal_info": [ { "product_id": "co.appeconomy.alarm.monthly", "auto_renew_status": "1", "auto_renew_product_id": "co.appeconomy.alarm.monthly", "original_transaction_id": "2000000320390725" } ] }, "auto_renew_status": "true", "notification_type": "INTERACTIVE_RENEWAL", "auto_renew_product_id": "co.appeconomy.alarm.monthly", "original_transaction_id": 2000000320390725 } From the product_id and subscription_group_identifier can recognize that I really resubscribed the same sku, so why? Does I miss any exceptional case in document?
Posted
by
Post not yet marked as solved
2 Replies
799 Views
Hello there, we have added url in App Store account in app information tan it is used for renewing user subscription after it is over. but at that time when user subscription is over, this url needs to be called to auto renew the user subscription but currently this url is not called by app store. can anyone have faced this issue before or any suggestion for this issue ?
Posted
by
Post not yet marked as solved
2 Replies
925 Views
assume that I have this 5 PRODUCT I purchase Weekly, then I switch to Monthly, it is upgrade, will receive INTERACTIVE_RENEWAL, indicate that new plan takes effect immediately. I purchase Yearly, then I switch to Monthly, it is downgrade, will receive DID_CHANGE_RENEWAL_PREF, indicate that new plan takes effect at the next renewal. I purchase Quarterly, then I switch to Quarterly2, it is crossgrade, will receive INTERACTIVE_RENEWAL, indicate that new plan takes effect immediately; Because the subscriptions are the same duration. I purchase Quarterly, then I switch to Monthly, it is crossgrade, will receive DID_CHANGE_RENEWAL_PREF, indicate that new plan takes effect at the next renewal; Because the durations are different. So, if I receive INTERACTIVE_RENEWAL notification, how can I recognize it is upgrade, or crossgrade to same duration product. If I receive DID_CHANGE_RENEWAL_PREF, how can I recognized it is downgrade, or crossgrade to different duration product. Does anyone can help me, thanks so much!! Orz
Posted
by
Post not yet marked as solved
2 Replies
556 Views
Hello we have implemented notification v2 but when a user refunds our sever doesn't lisnten notification from app store where as i have checked the implementation three times and on sandbox environment it's work fine. we have different web hook for production and dev environment. what we did... create a post webhook and set it as production v2 URL. on app make a purchase of consuable gems reund it via apple support but didn't reveive notification i didn't see a well documentation regarding this pls help
Posted
by
Post not yet marked as solved
1 Replies
647 Views
I have successfully configured my server url on appstoreconnect. I have tested the url using "https://api.storekit-sandbox.itunes.apple.com/inApps/v1/notifications/test" api and successfully got the event on my endpoint. But I do not receive any event for any successful purchase of Non-Renewing Subscription. Is there a way to enable these notifications. I am currently testing in sandbox account.
Posted
by
Post not yet marked as solved
1 Replies
602 Views
Dear Apple Support, We have configured HTTPS URLs for both Sandbox and Production in App Store Connect. These URLs are different for Sandbox and Production environments. We have created a Signed JWT and tested the notification feature in our dev environment with the Sandbox configuration, and it worked successfully. However, when we tried the same with the Production configuration, our server was unable to receive the notification. Our app is already live, and we have integrated consumable in-app purchases. Recently, one of our QA testers purchased a product and requested a refund from Apple support. Unfortunately, our server did not receive any notification from the app store about the refund, and we are unable to debug the issue. We would like to inform you that our server is TLS 1.2+ compliant, and we have properly configured an SSL certificate. We would appreciate your assistance in resolving these issues as soon as possible. Thank you for your time and help.
Posted
by
Post not yet marked as solved
0 Replies
515 Views
Hello - i'm transitioning my App from paid only to subscription model. I've been able to test in sandbox and parse the Receipt from Apple. Next is the App Store Server Notifications, i setup URL in App Store Connect. But now I need to see what this payload from Apple looks like so I can handle it. This seems like very hard to test, correct? What I did was setup a POST endpoint in my python backend after I liked . I ended up using libary I found https://pypi.org/project/app-store-notifications-v2-validator/. Does anyone have any tips on how to test these notifications from Apple?
Posted
by
Post not yet marked as solved
0 Replies
436 Views
I turn off the auto renwal, and after the current subscription expired, I call verifyReceipt api to check the latest status. I just found that "pending_renewal_info": [ { "auto_renew_product_id": "co.ringalarm.swtich.monthly", "is_in_billing_retry_period": "0", "product_id": "co.ringalarm.swtich.monthly", "original_transaction_id": "2000000333327838", "auto_renew_status": "0" } ], It is odd cause I thought this field is appear while subscription is into the billing retry. Does this field can help me to decide whether the subscription is expired?
Posted
by