Apple Store 支付

2020-03-12  本文已影响0人  8411e9740257

参考文章

*   [App 内购买项目](https://developer.apple.com/cn/in-app-purchase/)
*   [App 内购买项目类型](https://help.apple.com/app-store-connect/#/dev3cd978dbd)
*   [App 内购买项目信息](https://help.apple.com/app-store-connect/#/dev84b80958f)
*   [自动续期订阅信息](https://help.apple.com/app-store-connect/#/dev7f2d6b652)
*   [App 内购买项目状态](https://help.apple.com/app-store-connect/#/dev840c56fb6)
*   [测试 App 内购买项目](https://help.apple.com/app-store-connect/#/dev7e89e149d)

[图片上传失败...(image-126740-1587958325949)]

订阅通知状态

Indicates that either Apple customer support canceled the subscription or the user upgraded their subscription. The cancellation_date key contains the date and time of the change.

Indicates the customer made a change in their subscription plan that takes effect at the next renewal. The currently active plan is not affected.

Indicates a change in the subscription renewal status. Check auto_renew_status_change_date_ms and auto_renew_status in the JSON response to know the date and time of the last status update and the current renewal status.

Indicates a subscription that failed to renew due to a billing issue. Check is_in_billing_retry_period to know the current retry status of the subscription, and grace_period_expires_date to know the new service expiration date if the subscription is in a billing grace period.

Indicates successful automatic renewal of an expired subscription that failed to renew in the past. Check expires_date to determine the next renewal date and time.

Occurs at the initial purchase of the subscription. Store latest_receipt on your server as a token to verify the user’s subscription status at any time, by validating it with the App Store.

Indicates the customer renewed a subscription interactively, either by using your app’s interface, or on the App Store in the account's Subscriptions settings. Make service available immediately.

Indicates successful automatic renewal of an expired subscription that failed to renew in the past. Check expires_date to determine the next renewal date and time.

[图片上传失败...(image-ac420d-1587958325949)]

内购流程

1、流程图

image

2、流程说明

1.客户端向Appstore请求购买产品(假设产品信息已经取得),Appstore验证产品成功后,从用户的Apple账户余额中扣费。

2.Appstore向客户端返回一段receipt-data,里面记录了本次交易的证书和签名信息。

3.客户端向我们可以信任的服务器提供receipt-data。

4.服务器对receipt-data进行一次base64编码。

5.把编码后的receipt-data发往itunes.appstore进行验证。

6.itunes.appstore返回验证结果给服务器。

7.服务器对商品购买状态以及商品类型,向客户端发放相应的道具与推送数据更新通知。

8.客户端收到服务器的处理状态,进行相应的结单处理。

3、服务器处理订阅通知

4、续定无通知

同一个订单凭据是可以一直使用的,不管你后面续订了多少次,随便这些中的一个凭据发给苹果验证,就能得到所有的订单信息和订阅状态,这样每个周期结束的时候(试用期最后一天或者月底),就可以根据票据信息去得到用户是否仍然续订的信息,这样就可以决定是否继续给下个月的 VIP 了。

5、容易发生的问题

1.  漏单
2.  网络异常
3.  苹果服务器异常
4.  重单
5.  游客购买
上一篇下一篇

猜你喜欢

热点阅读