我可以从服务器获取应用内购买的价格吗? [英] Can I fetch the prices of in-app purchases from my server?

查看:45
本文介绍了我可以从服务器获取应用内购买的价格吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我的iOS应用必须向我的服务器询问可用的应用内购买产品,然后,对于这些产品,该应用必须向苹果询问价格.

Currently, my iOS app has to ask my server for the in-app purchase products available, and then afterwards, for the products, the app has to ask Apple for their prices.

为此增加的延迟可能不多,但我想使其更快.

The added delay for this is probably not much, but I'd like to make it faster.

我可以使用服务器而不是客户端来获取这些价格吗?也就是说,是否可以从服务器使用基于HTTP的API来为我而不是客户端获取价格?这样,我可以为不同的用户缓存结果并减少往返时间.如果是这样,我该怎么做?如果没有,您将以何种方式处理此问题?

Can I not use my server to fetch those prices instead of the client? That is, is there an HTTP-based API that I can use from the server to get the prices for me rather than the client? That way I can cache the results for different users and reduce the round trip time. If so, how can I do this? If not, in what ways are you handling this?

推荐答案

****客户端**-iOS应用 DS -Developer Server AppleS -Apple Server **

****Client**-iOS App DS-Developer Server AppleS-Apple Server**

与DS和amp;AppleS
当客户与AppleS进行通信时,相对于耗时的单个缺点,您有很多优点(如下所述).

Client communication with both DS & AppleS
When the Client communicates with the AppleS you have a couple of advantages (as mentioned below) against a single disadvantage of time consumption.

  1. 当您向AppleS发送一组应用内商品时,它会与一个人的有效发送有效产品ID(SKProduct的数组列表大批).这完全消除了展示产品的风险尚未注册,批准和批准的允许出售针对您的应用.

  1. When u send a set of In-App-Products to AppleS, it matches the one's valid & sends an array list of valid Product ID's (SKProduct Array). This completely eliminates the risk of displaying products which have not yet been registered, approved & cleared for sale against your app.

本地化-以价格为例.假设我正在销售产品在美国英国.该产品的价格将以美元为单位在DS中.因此,您最终向英国的用户显示了以美元为单位的价格.(在DS只能在某种程度上克服此问题一种根据用户所在国家/地区对货币进行本地化的机制.

Localization - Price as an example. S'pose I'm selling a product in US & UK. The price for this product will be in terms of say US $ in DS. So you end up showing the user in UK the price in US $. (In order to overcome this only up-to somewhat extent DS shall have a mechanism to localize the currency based on the user's country).

仅与DS进行客户端通信
回答你的问题;是的,您可以使用DS获取产品价格.您可以通过向商品对象添加另一个属性(价格)来实现此目的(从服务器上可用的应用内购买商品列表中).需要在DS上实施.

Client communication with only DS
To answer your question; Yup, u can use DS to fetch the price of the product. You achieve this by adding another attribute (price) to product object(from the list of in-app purchase products available from your server). Needs to be implemented at DS.

例如
Product1-应用内商品ID,价格,名称,示例图片等.
.
.
产品n-应用内商品ID,价格,名称,示例图片等

For Eg.
Product1 - in-app-product ID, Price, Name, Sample Image, etc.
.
.
Product n - in-app-product ID, Price, Name, Sample Image, etc.

好吧,现在我们该如何尝试结合Client与DS&AppleS只能与DS进行客户端通信吗?

Okay now how do we try to incorporate the couple of advantages from Client communicates with both DS & AppleS while using Client communication with only DS?

1 Adv-通过在DS端进行手动检查或通过某些定义的过程,可以确保仅显示有效产品.

1 Adv - By manual check at DS end or through some defined process one can make sure that only valid products are displayed.

2 Adv-要在某种程度上整合此功能,请实施以下@ DS

2 Adv - To incorporate this up-to somewhat extent implement the following @ DS

第1步–在DS端创建具有

Step 1–Create a DB table at DS end having the App Store pricing Matrix.
Step 2–When u hit a request from Client to DS, your DS can get the IP from service request hit. Depending on this DS service can find current country of User.
Step 3–Based on current country of the User, map the price in the localized currency from Step 1. In case current country of user is not a part of App Store pricing Matrix use the US$ price.(This is somewhat close to what apple does, though it uses country associated with Apple ID of the User).

与您显示的价格相同(避免您指出的不匹配-再次::)).

End result localized price displayed in IAP Confirmation Dialog will be same as price displayed by you (avoiding the mismatch as pointed out by you - somewhat again :-)).

在属于一个国家的用户拥有属于另一个国家的AppleID的情况下,整个实现将失败.它失败的原因是DS DS根据用户位置映射价格,但显示用户AppleID的基于价格的国家/地区(不匹配!).

This whole implementation will fail in a scenario when a user belonging one country has an AppleID belonging to some other country. It fail's coz DS maps price depending on location of user but IAP Confirmation Dialog shows price based country of the user's AppleID (Mismatch !!!).

U无法确定与国家/地区相关的国家Apple ID登录到iOS设备.检查此问答.

U can't determine Country associated with Apple ID logged into the iOS device. Check this Q&A.

我建议您实施与DS和amp;但是,AppleS的模型是为了减少当客户端与DS和Google都进行通信时的相关延迟.AppleS有多个产品请求(例如一次要设置10个产品,或者取决于您一次在用户界面中显示多少个产品).

I suggest you go implement 'Client communication with both DS & AppleS' model, however in order to reduce the delay associated when the Client communication with both DS & AppleS, have multiple product request(say a set of 10 products at a time or depending on how many products u display at a time in ur UI).

仅当您感觉或更准确地说进行分析时,肯定会因为延迟"而损失收入或用户,然后继续进行仅DS客户沟通"模型.

Only in case if you feel or more precisely have an analysis which say's you are bound to lose out revenue or the user because of the "delay" then go ahead with 'Client communication with only DS' model.

这篇关于我可以从服务器获取应用内购买的价格吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆