Skip to main content

Electron 2 中的新功能:应用内购买

· 4 min read

新的 Electron 2.0 发行版是 packed,包含新功能和修复。此新主要版本的一大亮点是针对 Apple Mac 应用商店 推出了新的 inAppPurchase API

¥The new Electron 2.0 release line is packed with new features and fixes. One of the highlights from this new major version is a new inAppPurchase API for Apple's Mac App Store.


应用内购买功能允许直接在应用内购买内容或订阅。这为开发者提供了一种轻松拥抱 免费增值商业模式 的方法,用户无需付费即可下载应用,并可以选择应用内购买高级功能、附加内容或订阅。

¥In-app purchases enable content or subscriptions to be purchased directly from within apps. This gives developers an easy way to embrace the freemium business model, wherein users pay nothing to download an app and are offered optional in-app purchases for premium features, additional content, or subscriptions.

社区贡献者 Adrien Fery 为 Electron 添加了新的 API,以便在 Amanote(一款用于讲座和会议的 Electron 注意应用)中启用应用内购买。Amanote 可免费下载,允许在 PDF 中添加清晰、结构化的注释,并具有数学公式、绘图、录音等功能。

¥The new API was added to Electron by community contributor Adrien Fery to enable in-app purchases in Amanote, a note-taking Electron app for lectures and conferences. Amanote is free to download and allows clear and structured notes to be added to PDFs, with features like mathematical formulae, drawings, audio recording, and more.

自从 Mac 版 Amanote 增加应用内购买支持以来,Adrien 注意到其销量增长了 40%!

¥Since adding in-app purchase support to the Mac version of Amanote, Adrien has noted a 40% increase in sales!

入门

¥Getting Started

新的 inAppPurchase API 已在最新的 Electron 测试版中推出:

¥The new inAppPurchase API has already landed in the latest Electron beta:

npm i -D electron@beta

API 的文档可在 在 GitHub 上找到 上找到,Adrien 也非常慷慨地编写了一篇关于如何使用 API 的教程。要开始在你的应用中添加应用内购买功能,请使用 查看教程

¥The docs for the API can be found on GitHub, and Adrien has been kind enough to write a tutorial on how to use the API. To get started adding in-app purchases to your app, see the tutorial.

更多 API 改进 正在开发中,并将很快在即将发布的 Electron 测试版中推出。

¥More improvements to the API are in the works, and will soon be landing in an upcoming Electron beta release.

Windows 可能是下一个

¥Windows Could Be Next

接下来,Adrien 希望通过在 Electron 中添加对 Microsoft Store 应用内购买的支持,为 Amanote 开辟新的收入渠道。敬请关注最新进展!

¥Up next, Adrien is hoping to open a new revenue channel for Amanote by adding support for Microsoft Store in-app purchases in Electron. Stay tuned for developments on that!