美文网首页
chrome extension in app purchase

chrome extension in app purchase

作者: 9b559869875b | 来源:发表于2017-11-17 20:03 被阅读4次

    在extension里卖虚拟物品

    1. Create a Google Payments Merchant account.

    2. Create the items you wish to sell via the Developer Dashboard in the Chrome Web Store.

    3. Include the appropriate buy.js file in your package.

    4. Wire up the sales flow.

    buy.js提供4个函数

    google.payments.inapp.getSkuDetails

    这个函数会返回你在dashboard上设置的 active items 数组

    google.payments.inapp.buy

    购买一个item

    google.payments.inapp.getPurchases

    返还用户已经购买的列表

    google.payments.inapp.consumePurchase

    消费一个 item.

    购买流程如下:

    首先用google.payments.inapp.getSkuDetails 函数拿到可购买的产品列表,展示给用户

    在展示之前,最好用google.payments.inapp.getPurchases来拿到用户已经购买的产品列表,把它从前面去掉,并且提醒用户他们已经买过这些了

    当一个用户点击Purchase 按钮,chrome会用他的登录账户来显示 Google payment processing window.

    当用户点击Accept and Buy, google的付款服务器就会处理付款,并且向用户显示一个购买确认对话框,success or failure 的回调函数会根据不同情况被调用

    相关文章

      网友评论

          本文标题:chrome extension in app purchase

          本文链接:https://www.haomeiwen.com/subject/cptsvxtx.html