守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: ANE FlasCC 炼金术
查看: 2160|回复: 0
打印 上一主题 下一主题

storekit-ANE(IOS+Android)

[复制链接]
  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    52903
    钢镚
    1422

    开源英雄守望者

    跳转到指定楼层
    楼主
    发表于 2015-1-26 17:45:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    应用下载
    应用名称: storekit-ANE(IOS+Android)
    支持64位:
    当前版本: 未知
    运行平台: Android IOS 
    开发语言: ActionScript 3 其他 
    应用类别: ANE-多平台
    应用简介: storekit-ANE(IOS+Android)
    iTunesConnect / GooglePlay / Amazon Market.
    Storekit iOS ANE

    Download the latest binary from here

    Android Setup

    The following must be merged into the application descriptor in the manifestAdditions section:

    1. <uses-permission android:name="com.android.vending.BILLING"/>
    2. <application android:enabled="true" @ANDROID_DEBUGGABLE@>
    3.   <activity android:name="com.jesusla.ane.CustomActivity"/>
    4.   <service android:name="com.jesusla.google.BillingService"/>
    5.   <receiver android:name="com.jesusla.google.BillingReceiver">
    6.     <intent-filter>
    7.       <action android:name="com.android.vending.billing.IN_APP_NOTIFY"/>
    8.       <action android:name="com.android.vending.billing.RESPONSE_CODE"/>
    9.       <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED"/>
    10.     </intent-filter>
    11.   </receiver>
    12.   <receiver android:name="com.amazon.inapp.purchasing.ResponseReceiver">
    13.     <intent-filter>
    14.       <action android:name="com.amazon.inapp.purchasing.NOTIFY"
    15.               android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY"/>
    16.     </intent-filter>
    17.   </receiver>
    18. </application>
    复制代码

    For Google Play In-App Billing:

    1. <meta-data android:name="SKProvider" android:value="Google"/>
    2. <meta-data android:name="SKIdentity" android:value="BASE64_ENCODED_PUBLIC_KEY"/>
    复制代码

    For Amazon In-App Purchases:

    1. <meta-data android:name="SKProvider" android:value="Amazon"/>
    复制代码
    Usage
    1. import com.jesusla.storekit.*;

    2. // StoreKit listeners should be setup as soon as app starts
    3. StoreKit.addEventListener(TransactionEvent.TRANSACTION_PURCHASED, storeKit_purchaseHandler);
    4. StoreKit.addEventListener(TransactionEvent.TRANSACTION_FAILED, storeKit_failureHandler);
    5. StoreKit.addEventListener(TransactionEvent.TRANSACTION_REVOKED, storeKit_revokeHandler);
    6. StoreKit.addEventListener(TransactionEvent.TRANSACTION_VERIFY, storeKit_verifyHandler);

    7. // Once listeners are setup, StoreKit should be initialized
    8. // PRODUCTS should be an array of Product IDs, which need to be previously configured in
    9. // iTunesConnect / GooglePlay / Amazon Market.
    10. const PRODUCTS:Array = [
    11.   'sku1', 'sku2', 'sku3', 'sku4', 'sku5', 'sku6'
    12. ];
    13. StoreKit.init(PRODUCTS, initCallback);

    14. function initCallback(success:Boolean):void

    15. // initCallback is called with a flag indicating the initialization status
    16. // If true, the system is ready to process orders. This flag can be
    17. // obtained at any time with the canMakePayments property. The caller
    18. // should adjust the UI appropriately in those cases when this flag is false.
    19. StoreKit.canMakePayments;

    20. // To request a purchase:
    21. StoreKit.requestPayment('sku1', requestCallback);

    22. // The success/failure of the purchase is reported in the optional
    23. // request callback. A true value does not mean that the purchase
    24. // went through. It simply means that the request was successful.
    25. function requestCallback(success:Boolean):void

    26. // As the transaction is processed, several events are fired.
    27. // If there's a problem with the transaction (e.g. user cancels
    28. // the transaction, the payment was declined, etc.) the event
    29. // TRANSACTION_FAILED is fired. The failure must be acknowledged
    30. // by finishing the transaction with acknowledgeTransaction()
    31. function storeKit_failureHandler(event:TransactionEvent):void {
    32.   // Acknowledge the failure. Omitting this step will
    33.   // cause the event to be constantly fired for this
    34.   // transaction until acknowledged.
    35.   StoreKit.acknowledgeTransaction(event.transaction);
    36. }

    37. // If the transaction succeeds, the TRANSACTION_VERIFY event
    38. // is fired. The client must now verify the transaction in an
    39. // implementation-specific manner (e.g. verifying its cryptographic
    40. // signature via a server-side request, etc.). The transaction
    41. // should be acknowledged if verification passes. Otherwise,
    42. // the transaction should be rejected.
    43. function storeKit_verifyHandler(event:TransactionEvent):void {
    44.   if (serverSideVerification(event.transaction))
    45.     StoreKit.acknowledgeTransaction(event.transaction);
    46.   else
    47.     StoreKit.rejectTransaction(event.transaction);
    48. }

    49. // After being successfully verified, the TRANSACTION_PURCHASED
    50. // event is fired. The transaction is now complete and should
    51. // be fulfilled. It is important not to acknowledge the transaction
    52. // before it is fulfilled.
    53. function storeKit_purchaseHandler(event:TransactionEvent):void {
    54.   if (fulfillTransaction(event.transaction))
    55.     StoreKit.acknowledgeTransaction(event.transaction);
    56. }

    57. // Finally, the TRANSACTION_REVOKED event may be fired for
    58. // transactions that are revoked/refunded server-side. The client must
    59. // revoke the goods (e.g. deduct coins, etc) and acknowledge the
    60. // transaction.
    61. function storeKit_revokeHandler(event:TransactionEvent):void {
    62.   if (revokeTransaction(event.transaction))
    63.     StoreKit.acknowledgeTransaction(event.transaction);
    64. }

    65. // Transactions are plain objects with the following properties:
    66. var transaction:Object = event.transaction;
    67. transaction.vendor; // One of VENDOR_APPLE, VENDOR_GOOGLE, VENDOR_AMAZON
    68. transaction.transactionState; // One of STATE_FAILED, STATE_VERIFY,
    69.                               // STATE_PURCHASED, STATE_REVOKED
    70. transaction.productIdentifier; // e.g. 'sku1' (String)

    71. // Note that during a VERIFY, only the first two fields are guaranteed
    72. // to be present. The rest of the fields will be vendor-specific.

    73. // Finally, the app may request restoring completed transactions.
    74. // This will cause all non-consumable historic transactions to be
    75. // resent to the client with a STATE_PURCHASED state. The optional callback
    76. // is notified with a flag indicating success/failure
    77. StoreKit.restoreCompletedTransactions(restoreCallback);

    78. function restoreCallback(success:Boolean):void
    复制代码








    相关链接:

    https://github.com/jlopez/ane-storekit

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?立即注册

    x
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
    收藏收藏 分享分享 支持支持 反对反对 微信
    守望者AIR技术交流社区(www.airmyth.com)
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    
    关闭

    站长推荐上一条 /4 下一条

    QQ|手机版|Archiver|网站地图|小黑屋|守望者 ( 京ICP备14061876号

    GMT+8, 2026-1-23 23:23 , Processed in 0.050482 second(s), 37 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

    快速回复 返回顶部 返回列表