Facebook 积分和外币

发布于 2024-12-04 09:44:17 字数 220 浏览 0 评论 0原文

我正在开发一个使用 FB Credits 作为货币的应用程序,但是,我的客户将以当地货币(ILS、以色列谢克尔)付款。

我知道 1 个积分的汇率是 10 美分,但是,ILS 的价格似乎随着 USD-ILS 汇率的变化而变化。

有没有办法查询 Facebook 服务器以了解用户将以当地货币支付的价格?就像查询价目表的方式一样。许多新用户不理解积分的概念,我想向他们展示他们将用当地货币支付什么。

I am developing an application that uses FB Credits as a currency, however, my clients are going to be paying in their local currency (ILS, israeli sheqel).

I know the rate for 1 credit is 10 cents, however, the price in ILS seems to be changing according to changes in the exchange-rates of USD-ILS.

Is there a way to query Facebook Server to know the prices users are going to be charged in their local money? Like a way to query the pricelist. Many new users don't understand the concept of credits and i'd like to show them what they're about to pay in local money.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

十雾 2024-12-11 09:44:18

正如 OffBySome 所说,Facebook 没有可用的汇率信息。考虑到这一点,我明白为什么他们没有这个,因为他们不希望您显示商品的当地货币价格。尽管目前 Facebook Credits 相对较新,最终用户也存在很多困惑,但最终当它广泛普及时,这些问题就不会再出现了。

我现在建议(正如我所做的那样 - 这里 1 个 Facebook Credit 目前约为 7p),您只需在应用程序中以当地货币硬编码 1 个 Facebook Credit 的价格,并在需要时显示此价格。我认为 Facebook 不支持这一点的原因之一是他们没有设想使用 Credits 的应用程序仅限于一个地区,但实际上并非所有东西都是可以在全球范围内使用的游戏。 :)

As stated by OffBySome, Facebook do not have exchange rate information available. Thinking about this, I can see why they don't have this as they do not want you to display the local currency price for items. Although at the moment Facebook Credits are relatively new, and there is a lot of confusion for end users, eventually when it becomes widespread there won't be these issues.

I would suggest for now (as that is what I have done - here one Facebook Credit is currently ~7p) that you just hard code in your app the price of 1 Facebook Credit in your local currency, and if required display this. I think one of the reasons why Facebook don't support this is that they didn't envisage apps using Credits to be restricted to one territory, however in reality not everything is a game to be used worldwide. :)

愿得七秒忆 2024-12-11 09:44:18

为了总结这个问题,我尝试了两种方法。一种是使用这个 python 函数每 10 分钟从 openexchange 提取一次汇率:

def update_ils_rate():
    print "Updating ILS/USD exchange rate"
    url = 'http://openexchangerates.org/latest.json'
    response = requests.request('get', url)
    content = response.content
    data = loads(content)
    return data['rates']['ILS']

但是,facebook Credits 似乎根据不同的汇率计算 ILS(israeli sheqel) 汇率(计算结果略有偏差)。因此,我们决定使用以下函数从以色列中央银行提取 xml 数据:

import requests, BeautifulSoup

def get_ils_rate():
    response = requests.request('get', 'http://www.bankisrael.gov.il/currency.xml')
    content = response.content    
    soup = BeautifulSoup(content)
    currencies = soup.findAll('currency')
    for c in currencies:
        if c.currencycode.contents[0]=='USD':
            return float(c.rate.contents[0])

Just to sum this question up, I tried two methods. One was to pull the rate every 10 minutes from openexchange using this python function:

def update_ils_rate():
    print "Updating ILS/USD exchange rate"
    url = 'http://openexchangerates.org/latest.json'
    response = requests.request('get', url)
    content = response.content
    data = loads(content)
    return data['rates']['ILS']

However it seems that facebook credits calculates ILS(israeli sheqel) rate according to a different rate (calculations were off by a little). So we have decided to pull xml data from israel's central bank, using this function:

import requests, BeautifulSoup

def get_ils_rate():
    response = requests.request('get', 'http://www.bankisrael.gov.il/currency.xml')
    content = response.content    
    soup = BeautifulSoup(content)
    currencies = soup.findAll('currency')
    for c in currencies:
        if c.currencycode.contents[0]=='USD':
            return float(c.rate.contents[0])
酒中人 2024-12-11 09:44:17

Facebook Credits API 没有可用的汇率信息。您可以在他们的开发者小组中请求此功能。最好的办法是拉下汇率源(如果你搜索的话,有大量可用的)并显示它,并警告说这只是一个估计汇率,它取决于 Facebook 使用的实际汇率。

The Facebook Credits API doesn't have exchange rate information available. You could request this feature on their developer group. You're best bet would be to pull down an exchange rate feed (there are tons available if you search) and display that with a warning that it is just an estimated rate and that it is dependent on the actual exchange rate Facebook uses.

安穩 2024-12-11 09:44:17

xe.com 是一个很棒的提要,您还可以从雅虎或谷歌财经获取数据

xe.com is a great feed , you can also pull data from yahoo or google finance

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文