user10387205
user10387205

Reputation:

App Store server to server notifications purpose?

App Store has so called "server-to-server" notifications. That is, when you purchase in-app feature, Apple server make HTTPS request to your server's callback method (send receipt data).

The thing is - it seems to be no user information in receipt data. For example:

"receipt": {
    "original_purchase_date_pst": "2019-03-11 07:35:59 America/Los_Angeles",
    "unique_identifier": "cca492f511da9fb203600195aadf00b5ad11c2f8",
    "original_transaction_id": "1000000509597835",
    "expires_date": "1552389553000",
    "transaction_id": "1000000509597835",
    "quantity": "1",
    "product_id": "com.quest.subscriptiontest.pack1",
    "bvrs": "3",
    "bid": "com.quest.SubscriptionTest",
    "unique_vendor_identifier": "8F59FA71-A8AC-474F-9967-AC06366BE376",
    "web_order_line_item_id": "1000000043169670",
    "original_purchase_date_ms": "1552314959000",
    "expires_date_formatted": "2019-03-12 11:19:13 Etc/GMT",
    "purchase_date": "2019-03-12 11:16:13 Etc/GMT",
    "is_in_intro_offer_period": "false",
    "purchase_date_ms": "1552389373000",
    "expires_date_formatted_pst": "2019-03-12 04:19:13 America/Los_Angeles",
    "is_trial_period": "false",
    "purchase_date_pst": "2019-03-12 04:16:13 America/Los_Angeles",
    "original_purchase_date": "2019-03-11 14:35:59 Etc/GMT",
    "item_id": "1454809891"
  } 

I see here only information about purchase itself and I don't see anything about the user (who made this purchase). So what is the scenario of using such notifications without user info? Is it only for calculating financial statistics or what?

Upvotes: 1

Views: 1872

Answers (2)

Yogesh Kaushik
Yogesh Kaushik

Reputation: 470

I suppose you missed the real advantage of server-2-server notifications. They are meant to notify the developers for change in subscription state of a user in near real-time.

"notification_type": "DID_CHANGE_RENEWAL_STATUS"

This field here identifies that the user has turned off the renewal (Cancelled).

Using this feature you can get to know about state changes which are not possible to know by the help of your app.

  • Change Plan (if user upgrades/downgrades the offers from Apple Settings, this is the way to know this and act accordingly)
  • Cancellations
  • Re-subscriptions (if done using Apple settings UI)
  • Renewal of a subscription which was in billing retry window.

Upvotes: 2

etse
etse

Reputation: 61

It's expected that you store user data on your own servers. This is how I do it.

  1. Send receipt from iOS app to server
  2. Server stores receipt as user data
  3. Server uses Apple's receipt verification to get the original_transaction_id and store that as user data. Probably should index this column/field.
  4. Subsequent Apple server-to-server notifications will contain the original_transaction_id which you can use to look up the user.

I have open-sourced a server that handles iOS App Store subscriptions using server-to-server notifications and active polling at https://github.com/carpenterscode/superscribe

Feel free to use it out-of-box, or reference it to get your own solution working.

Upvotes: 4

Related Questions