简体   繁体   English

我们可以在应用程序购买收据中将 iOS 存储到我们的服务器吗

[英]Can we store iOS in app purchase receipt to our server

I am developing an in app purchase app (auto renewal) and purchase/cancellation should effect on all platform (Android, iOS, Web).我正在开发一个应用内购买应用程序(自动续订),购买/取消应该影响所有平台(Android、iOS、Web)。

My question is what is best way to keep track the latest status of the purchase.我的问题是什么是跟踪购买最新状态的最佳方式。 I know there is a way called server to server notification using web hook, but I am thinking can we store the receipt data to server and validate this receipt time to time with iTunes apis?我知道有一种方法称为服务器到服务器通知使用 web 挂钩,但我想我们可以将收据数据存储到服务器并使用 iTunes api 不时验证这个收据吗?

Does receipt data change over the updates on subscription or it is same even after changing the device?收据数据是否会随着订阅的更新而改变,或者即使在更换设备后也一样?

All I want to validate it at server side, because there is a possibility that user can uninstall the app or not using it.我只想在服务器端验证它,因为用户有可能卸载应用程序或不使用它。

You can validate the receipts at server end.您可以在服务器端验证收据。 There are two options.有两种选择。

  1. Enabling server to server notifications.启用服务器到服务器通知。

  2. Store all receipts in your databases and verify it with server for latest update.将所有收据存储在您的数据库中,并与服务器验证以获取最新更新。

You need to use meta data from the receipt under key "latest_receipt" to get the latest update in the subscription.您需要使用键“latest_receipt”下收据中的元数据来获取订阅中的最新更新。

Below is the link for reference.以下是供参考的链接。

https://developer.apple.com/documentation/storekit/in-app_purchase/validating_receipts_with_the_app_store#//apple_ref/doc/uid/TP40010573-CH104-SW1 https://developer.apple.com/documentation/storekit/in-app_purchase/validating_receipts_with_the_app_store#//apple_ref/doc/uid/TP40010573-CH104-SW1

Initial receipt meta data does not change over the time.初始收据元数据不会随着时间而改变。 You can save initial receipt metadata in your database and use it for further updates like - renewal, cancellation, upgrade or downgrade, refund etc.您可以将初始收据元数据保存在数据库中,并将其用于进一步更新,例如续订、取消、升级或降级、退款等。

Yes, you can, moreover server-to-server validation & observing is most preferable way recommended by Apple.是的,您可以,而且服务器到服务器的验证和观察是 Apple 推荐的最可取的方式。 They provided JSON API and accepts your server end-point to post any changes directly to server.他们提供了 JSON API 并接受您的服务器端点以将任何更改直接发布到服务器。

For details read Choosing a Receipt Validation Technique and related in topic.有关详细信息,请阅读选择收据验证技术和相关主题。

The common start point is In-App Purchase共同的起点是应用内购买

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM