ios应用内购买



用户向苹果服务器发起购买请求收到购买完成的回调购买完成后会把钱打给申请内购的银行卡内)
购买成功流程结束后, 向服务器发起验证凭证app端自己也可以不依靠服务器自行验证)
自己的服务器工作分 4 
* 1接收 iOS 端发过来的购买凭证
* 2判断凭证是否已经存在或验证过然后存储该凭证
* 3将该凭证发送到苹果的服务器区分沙盒环境还是正式环境验证并将验证结果返回给客户端。
sandbox 开发环境https://sandbox.itunes.apple.com/verifyReceipt
prod 生产环境:https://buy.itunes.apple.com/verifyReceipt
* 4修改用户相应的会员权限或发放虚拟物品
简单来说就是将该购买凭证用 Base64 编码然后 POST 给苹果的验证服务器苹果将验证结果以 JSON 形式返回



对于自动续订订阅我们自己的服务器完全可以与apple server的交互应对用户的订阅状态只需要确定客户端传来的用户第一次购买 user id 对应 original-transaction-id的关系后面的续订取消变更套餐完全不依赖于客户端传来的信息


For auto-renewable subscriptions, the App Store can also notify your server of key subscription events.


Understand Product Types
There are four In-App Purchase types you can offer:
* Consumables are a type that are depleted after one use. Customers can purchase them multiple times. 
* Non-consumables are a type that customers purchase once. They don't expire. 
* Auto-renewable subscriptions to services or content are a type that customers purchase once and that renew automatically on a recurring basis until customers decide to cancel. 
* Non-renewing subscriptions to services or content provide access over a limited duration and don't renew automatically. Customers can purchase them again.

消耗型非消耗型自动续期订阅和非续期订阅




Loading Disqus comments...
Table of Contents