V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
brader
V2EX  ›  问与答

请教苹果 verifyReceipt 弃用的解决方案

  •  
  •   brader · 318 天前 · 1156 次点击
    这是一个创建于 318 天前的主题,其中的信息可能已经有所发展或是发生改变。
    苹果接口文档: https://developer.apple.com/documentation/appstorereceipts/verifyreceipt

    我们服务端是使用这个接口( https://buy.itunes.apple.com/verifyReceipt )来给客户端验证订阅交易以及做恢复购买。还有个业务,会每天从该接口拉取交易信息,做一些统计的。

    今天上官网看了下,里面突然写着弃用了,目前实际是还能用,担心以后用不了。

    我看了一遍文档,不能理解它的意思,没看出来官方是让我们用什么样的替代方案。
    还有个问题就是真要换的话,我们以前的老用户怎么办,一定要强制升级 APP 吗?
    6 条回复    2023-09-20 22:32:29 +08:00
    xaoflysho
        1
    xaoflysho  
       318 天前
    https://developer.apple.com/documentation/appstorereceipts/validating_receipts_with_the_app_store

    Important
    The verifyReceipt endpoint is deprecated. To validate receipts on your server, follow the steps in Validating receipts on the device on your server. To validate in-app purchases on your server without using receipts, call the App Store Server API to get Apple-signed transaction and subscription information for your customers, or verify the AppTransaction and Transaction signed data that your app obtains. You can also get the same signed transaction and subscription information from the App Store Server Notifications V2.
    brader
        2
    brader  
    OP
       318 天前
    @xaoflysho 这个文档我也看了,但是我还是理解不了怎么解决,我以前是会拿接口返回中的 latest_receipt_info 字段的数据做统计的,如果这个接口弃用后,我不知道从哪里去拿
    4mYHime
        3
    4mYHime  
       295 天前
    现在是不是得前端传 transaction ID ,然后后端去 v1/transactions 查
    fgd
        4
    fgd  
       222 天前
    现在有什么解决方案吗?
    原来我们的做法是:
    1. app 可以调用服务端验收据,服务端根据苹果返回的收据信息给用户发权益。
    2. 监听苹果服务端通知,收到订阅事件也可以给用户发权益。

    我们在考虑,verifyReceipt 弃用后,只靠 2 监听服务端通知来给用户发权益是否可行
    brader
        5
    brader  
    OP
       222 天前   ❤️ 1
    @fgd 发权益肯定是没问题的,苹果也是推荐使用他们的回调通知 V2 版接口的。但我们做的不仅仅是购买支付流程,我们还做了一个数据统计功能,如果苹果废弃这个接口,我们实现起来比较麻烦,重新做成本也大
    fgd
        6
    fgd  
       220 天前
    @brader verifyReceipt 接口拉数据。可以从 https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history 这里获取,apple 也出了 sdk https://github.com/apple/app-store-server-library-python ,不过还是 beta 版本,可以参考。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5088 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 03:51 · PVG 11:51 · LAX 20:51 · JFK 23:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.