We are implementing IAP in our React-Native app, currently only on IOS, specifically subscriptions.
We have configured the Sandbox Server URL to an endpoint on our Dev server, and the Production Server URL to an endpoint on our Production server.
In addition, we are using the Apple App Store Server Node.js Library on our Backend to verify receipts, getting transactions history, etc. We are using the Sandbox environment on our Dev backend, and the Production environment on our Production backend.
We are not sure if that is the correct setup, although that is what we understood from multiple sources. While testing with TestFlight, with production apple accounts, we were expecting to receive the server notifications on our Production server, but they were all were received on our Development server (Sandbox endpoint).
Is that the correct behavior or are we missing something?
We figured the Sandbox endpoint was for testing purposes and because of that should be on our Development backend while we develop.
App Store Server Notifications
RSS for tagMonitor subscription events in real time with server notifications from the App Store using App Store Server Notifications.
Posts under App Store Server Notifications tag
96 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I'm trying to implement an IAP subscripton and I am not receiving DID_RENEW/EXPIRED webhook calls.
Looking through previous forum posts this may just be breaking randomly, is there something currently broken or is there likely some setup I'm missing?
Note: I'm using ngrok to test this locally, and I successfully get the initial subscription and DID_CHANGE_RENEWAL_STATUS events.
I have found such information on documentation:
Upgrade. Someone purchases a subscription that offers a higher level of service than their current subscription. They’re immediately upgraded and receive a refund of the prorated amount of their original subscription. If you’d like people to immediately access more content or features, rank the subscription higher to make it an upgrade.
Also,
To identify whether a subscription has been refunded, look for the cancellation_date field in the receipt.
However, when looking at users that has upgraded subscriptions, where we get
"is_upgraded": "true"
There is no cancellation_date field, so the question is, has these users been refunded? If so, how do we calculate partial refunds without the date?
Hi,
We are using V2 App Store Server Notifications but can't figure out where to get the following subscription info:
the price of the subscription (can't find anywhere)
billing period duration e.g. "P1M" for monthly subscription
Google Play billing has these properties so we expect that these properties also exist in the app store.
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
Hello I've problem with transaction payload. If I receive POST App Store notification v2 to my server. In the decoded transaction body is missing appAccountToken field. In the iOS app I've just set token like this:
let result = try await product.purchase(options: [
.appAccountToken(UUID.encodeIntAsUUID(Auth.shared.user.idUser)),
.simulatesAskToBuyInSandbox(true)
])
Where is the problem?
Hello
I want to know the difference between type EXPIRED with subtype BILLING_RETRY and type GRACE_PERIOD_EXPIRED because these notifications looks similar
Hello I want to know about App Store server notification type after subscription started with offer code,
question is
when someone starts a subscription with an offer code, only type OFFER_REDEEMED[subtype INITIAL_BUY] is send to server?
or
both type OFFER_REDEEMED[subtype INITIAL_BUY] and type SUBSCRIBED[subtype INITIAL_BUY] are send to server?
I'm testing subscription IAP app store server notifications.
In the case of subscription payment, when the user cancels the subscription, you can check through the server notification. However, if the cancellation is made before the expiration of the subscription period, can we receive server notifications even when the subscription expires?
Cause in sandbox env I notice a receipt like this
{
"environment": "Sandbox",
"unified_receipt": {
"status": 0,
"environment": "Sandbox",
"latest_receipt_info": [
{
"quantity": "1",
"product_id": "3monthplan",
"expires_date": "2023-07-25 04:50:29 Etc/GMT",
"purchase_date": "2023-07-25 04:41:29 Etc/GMT",
"transaction_id": "2000000375156349",
"expires_date_ms": "1690260629000",
"is_trial_period": "false",
"expires_date_pst": "2023-07-24 21:50:29 America/Los_Angeles",
"purchase_date_ms": "1690260089000",
"purchase_date_pst": "2023-07-24 21:41:29 America/Los_Angeles",
"in_app_ownership_type": "PURCHASED",
"original_purchase_date": "2023-07-25 03:20:41 Etc/GMT",
"web_order_line_item_id": "2000000032603282",
"original_transaction_id": "2000000375122102",
"is_in_intro_offer_period": "false",
"original_purchase_date_ms": "1690255241000",
"original_purchase_date_pst": "2023-07-24 20:20:41 America/Los_Angeles",
"subscription_group_identifier": "20572434"
},
....
{
"quantity": "1",
"product_id": "3monthplan",
"expires_date": "2023-07-25 04:03:49 Etc/GMT",
"purchase_date": "2023-07-25 03:54:49 Etc/GMT",
"transaction_id": "2000000375136003",
"expires_date_ms": "1690257829000",
"is_trial_period": "false",
"expires_date_pst": "2023-07-24 21:03:49 America/Los_Angeles",
"purchase_date_ms": "1690257289000",
"purchase_date_pst": "2023-07-24 20:54:49 America/Los_Angeles",
"in_app_ownership_type": "PURCHASED",
"original_purchase_date": "2023-07-25 03:20:41 Etc/GMT",
"web_order_line_item_id": "2000000032600544",
"original_transaction_id": "2000000375122102",
"is_in_intro_offer_period": "false",
"original_purchase_date_ms": "1690255241000",
"original_purchase_date_pst": "2023-07-24 20:20:41 America/Los_Angeles",
"subscription_group_identifier": "20572434"
},
{
"quantity": "1",
"product_id": "monthlyplan",
"expires_date": "2023-07-25 03:38:37 Etc/GMT",
"purchase_date": "2023-07-25 03:35:37 Etc/GMT",
"transaction_id": "2000000375127458",
"expires_date_ms": "1690256317000",
"is_trial_period": "false",
"expires_date_pst": "2023-07-24 20:38:37 America/Los_Angeles",
"purchase_date_ms": "1690256137000",
"cancellation_date": "2023-07-25 04:38:50 Etc/GMT",
"purchase_date_pst": "2023-07-24 20:35:37 America/Los_Angeles",
"cancellation_reason": "0",
"cancellation_date_ms": "1690259930000",
"cancellation_date_pst": "2023-07-24 21:38:50 America/Los_Angeles",
"in_app_ownership_type": "PURCHASED",
"original_purchase_date": "2023-07-25 03:20:41 Etc/GMT",
"web_order_line_item_id": "2000000032600434",
"original_transaction_id": "2000000375122102",
"is_in_intro_offer_period": "false",
"original_purchase_date_ms": "1690255241000",
"original_purchase_date_pst": "2023-07-24 20:20:41 America/Los_Angeles",
"subscription_group_identifier": "20572434"
},
...
]
},
"auto_renew_status": "false",
"cancellation_date": "2023-07-25 04:38:50 Etc/GMT",
"notification_type": "CANCEL",
"cancellation_date_ms": "1690259930000",
"auto_renew_product_id": "3monthplan",
"cancellation_date_pst": "2023-07-24 21:38:50 America/Los_Angeles",
"web_order_line_item_id": "2000000032600434",
"original_transaction_id": 2000000375122102
}
plan is keeping renew.
What if I refund in prod env, and after refund agree, is that my subscription would auto turn off?
We are attempting to monitor subscription events via App Store Server Notifications. The URL we have configured (with v1 or v2) continually gets invoked with GET requests instead of POST requests, we do not get any POST with request data at all and cannot process subscription changes.
Why might this be happening? What could we have misconfigured?
configuration:
requests:
I have been experiencing with my app's subscription renewal process. When a user successfully renews their subscription, the App Store sends an event to my backend server. However, in some cases, the backend server is receiving an event that says the renewal failed, even though the user's subscription was successfully renewed.
I have been working on this bug for several days and I have not been able to find a solution. I would appreciate any help that you can provide.
Based on this site https://support.apple.com/en-us/HT202039 the subscription can be cancelled & re-subscribe by user on iPhone devices.
I'm asking for the payment lifecycle included with subscription status when subscription is canceled, re-subscribe, or subscription is EXPIRED.
Please explain billing lifecycle to our bank account based on subscription status.
Thankyou.
My app is develop using react native and i use react-native-iap package for ios IAP.
I have 1 non-consumable IAP products, and i need to receive callback from Apple Server to Our Server, but it still didn't coming yet, how i supposed to check this?
I have already setup the url on Sandbox Server URL, and have already successfully send the notification test using https://api.storekit-sandbox.itunes.apple.com/inApps/v1/notifications/test
the response from notification test is below:
{
"testNotificationToken": "19d-8f54-41cd-84cf-e9265df_16***4897"
}
ASAP,
Thankyou
I have a non-renewable subscription set up in my app and I also have App Store Server Notifications enabled, with URLs for both the production server and the sandbox server to receive version 2 notifications. I can simulate payment subscription in my app with sandbox tester, however I am not getting any notification from the app store server. Is there anything else I need to configure?
Hello everyone!
I have some doubts on the use cases and triggers related to the REFUND_REVERSED notification type.
I would like to better understand which real customer actions example would trigger this notification to be sent.
Does the developer gets back the amount refunded to the user?
Quoting the documentation: If your app revoked content or services as a result of the related refund, it needs to reinstate them. This applies only to a REFUND_REVERSED associated to a REFUND of the latest possible renewal right? Since we receive REFUND_REVERSED also several weeks after the REFUND and so for long expired subscriptions. We don't have to get access again to the user in the latter case, do we?
Thank you very much to whoever will take time to answer!
I am trying to understand the correct flow for a mobile app/server app - auto-renewable subscriptions.
Since verifyReceipt has been marked as deprecated, I am struggling with how I should link an App Store Server Notification v2 message with a user in the database.
Currently, the process is as follows:
First, the mobile application calls our server with receipt-data. Second, the server calls verifyReceipt to validate the receipt. Then, I am able to match the user's subscription/transaction with their data (using an internal JWT with user data from the first step and originalTransactionId from decoded verifyReceipt response). If we omit the first step, how would I determine who should receive the App Store Server Notification v2 message?
I am planning to use the Get Notification History API to receive refund notifications for consumable in-app purchases.
In order to receive notification data from this API, do I need to set up an HTTPS URL in App Store Connect to receive App Store Server Notifications?
The problem that I am experiencing is that the subscription is successful even if i try to subscribe once more it will say that i am already subscribed, but if i try to cancel it, in my sandbox account there is no subscriptions.
Not sure it is related but the other issue that i am experiencing is that the webhook is not called
We followed all step given in Docs but getting authenticate error for other apple account that I am using
Below is details of error
my command:
curl -v -H 'Authorization: Bearer eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNCQzczUjlEV0MifQ.eyJpc3MiOiI2OWE2ZGU4ZS1iNGZhLTQ3ZTMtZTA1My01YjhjN2MxMWE0ZDEiLCJhdWQiOiJhcHBzdG9yZWNvbm5lY3QtdjEiLCJpYXQiOjE2ODc4NDIwNjA4NDksImV4cCI6MTY4Nzg0NTY2MDg0OSwiYmlkIjoiY29tLm9uZmVyZW5jZS5vbmZlcmVuY2VhcHAifQ.W8_vaEPZoinC-80bBq-g3XLkohb_FSPzGN4a4YfqJ_V1UnmBmrtz2GtBPHhlQRB1VJ7NE3n3BNAWUMJrD5AuEA' "https://api.storekit.itunes.apple.com/inApps/v1/transactions/340001235870976"
Error gettings
Trying 17.56.138.9...
TCP_NODELAY set
Connected to api.storekit.itunes.apple.com (17.56.138.9) port 443 (#0)
ALPN, offering h2
ALPN, offering http/1.1
successfully set certificate verify locations:
CAfile: /etc/ssl/cert.pem
CApath: none
TLSv1.2 (OUT), TLS handshake, Client hello (1):
TLSv1.2 (IN), TLS handshake, Server hello (2):
TLSv1.2 (IN), TLS handshake, Certificate (11):
TLSv1.2 (IN), TLS handshake, Server key exchange (12):
TLSv1.2 (IN), TLS handshake, Server finished (14):
TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
TLSv1.2 (OUT), TLS handshake, Finished (20):
TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
TLSv1.2 (IN), TLS handshake, Finished (20):
SSL connection using TLSv1.2 / ECDHE-RSA-CHACHA20-POLY1305
ALPN, server accepted to use h2
Server certificate:
subject: businessCategory=Private Organization; jurisdictionCountryName=US; jurisdictionStateOrProvinceName=California; serialNumber=C0806592; C=US; ST=California; L=Cupertino; O=Apple Inc.; CN=commercegateway.itunes.apple.com
start date: May 16 16:44:52 2023 GMT
expire date: Nov 12 16:54:52 2023 GMT
subjectAltName: host "api.storekit.itunes.apple.com" matched cert's "api.storekit.itunes.apple.com"
issuer: C=US; O=Apple Inc.; CN=Apple Public EV Server RSA CA 2 - G1
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 0x7f9bed010800)
GET /inApps/v1/transactions/340001235870976 HTTP/2
Host: api.storekit.itunes.apple.com
User-Agent: curl/7.64.1
Accept: /
Authorization: Bearer eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjNCQzczUjlEV0MifQ.eyJpc3MiOiI2OWE2ZGU4ZS1iNGZhLTQ3ZTMtZTA1My01YjhjN2MxMWE0ZDEiLCJhdWQiOiJhcHBzdG9yZWNvbm5lY3QtdjEiLCJpYXQiOjE2ODc4NDIwNjA4NDksImV4cCI6MTY4Nzg0NTY2MDg0OSwiYmlkIjoiY29tLm9uZmVyZW5jZS5vbmZlcmVuY2VhcHAifQ.W8_vaEPZoinC-80bBq-g3XLkohb_FSPzGN4a4YfqJ_V1UnmBmrtz2GtBPHhlQRB1VJ7NE3n3BNAWUMJrD5AuEA
Connection state changed (MAX_CONCURRENT_STREAMS == 1024)!
< HTTP/2 401
< server: daiquiri/3.0.0
< date: Tue, 27 Jun 2023 05:34:00 GMT
< content-type: text/plain
< strict-transport-security: max-age=31536000; includeSubDomains
< x-apple-jingle-correlation-key: Z4AC6TLUWQRJHHYNLGGL5L2EZA
< x-daiquiri-instance: daiquiri:15824002:mr85p00it-hyhk03174701:7987:23RELEASE91:daiquiri-amp-commerce-clients-ext-001-mr
<
Unauthenticated
Request ID: Z4AC6TLUWQRJHHYNLGGL5L2EZA.0.0
Connection #0 to host api.storekit.itunes.apple.com left intact
Closing connection 0