Upgrade to Pro — share decks privately, control downloads, hide ads and more …

アプリ内課金
プラグインの現状 / Present situation of in-app p...

アプリ内課金
プラグインの現状 / Present situation of in-app purchase in Flutter

2019/03/26 Flutter Meetup Tokyo #8 15分LT資料
https://flutter-jp.connpass.com/event/121387/

English title: Present situation of in-app purchase in Flutter

Yasutaka Kawamoto

March 26, 2019
Tweet

More Decks by Yasutaka Kawamoto

Other Decks in Programming

Transcript

  1. • Տຊ ହ޹(Yasutaka Kawamoto) • ॴଐɿגࣜձࣾ tech vein (େࡕ) •

    ϞόΠϧΞϓϦΤϯδχΞ • GitHub: kwmt 
 twitter: kwmt27 • Google I/O2018 ॳࢀՃ • Flutterྺɿ9ϲ݄ 3 ࣗݾ঺հ
  2. 9 ΞϓϦ಺՝ۚͷछྨ(App Store) छྨ આ໌(ίϯςϯπͷྫ) ఆظߪಡ ݄୯Ґ΍೥୯ҐͰ՝ۚ͞Εɺղ໿͢Δ·Ͱܧଓ͢ Δ΋ͷɻ(ఆظߪಡͷ৽ฉͳͲ) ফඅܕ ඞཁͳͱ͖ʹຖճߪೖ͢ΔλΠϓͰແྉͰ࠶μ΢

    ϯϩʔυͰ͖ͳ͍΋ͷɻ(ήʔϜͷ௨՟ͳͲ) ඇফඅܕ 1ճͷΈߪೖ͕ՄೳͰͦΕҎ߱͸AppleIDʹؔ࿈෇ ͚ΕΒΕ͍ͯΔσόΠεʹసૹͰ͖Δ΋ͷɻ
 (޿ࠂͷ࡟আͳͲ) https://support.apple.com/ja-jp/HT202023
  3. 10 ΞϓϦ಺՝ۚͷछྨ(Google Play) छྨ આ໌(ίϯςϯπͷྫ) ఆظߪೖ (Subscriptions) Ϣʔβʔ޲͚ίϯςϯπɺαʔϏεɺػ ೳΛΞϓϦ಺Ͱ݄୯Ґ·ͨ͸೥୯ҐͰ ՝ۚͰ͖Δ΋ͷɻ(ΦϯϥΠϯࡶࢽͳͲ)

    ؅ཧର৅ͷ
 ΞϓϦ಺ΞΠςϜ (One-time products) ຖճࢧ෷͍͕ඞཁͳ΋ͷɻ (ήʔϜ಺௨՟ɺ৯ྐɺढจͳͲ) https://developer.android.com/google/play/billing/api.html?hl=ja#producttypes
  4. 14 1. flutter_inapp_purchase (Basic) ఆظߪೖ Մೳ ఆظߪೖҎ֎ Մೳ Overall score

    97 GitHub star 196 last updated Mar 18, 2019 version 0.9.2 Dart code static methods AndroidɺiOS javaɺobj-c ※2019/03/24࣌఺ͷσʔλ
  5. 15 1. flutter_inapp_purchase (How to use) class IAPDataSource {
 void

    sample() async {
 
 await FlutterInappPurchase.initConnection; List<String> skus = []..add(sku);
 /// ఆظߪೖͷ঎඼Λऔಘ
 List<IAPItem> list = await 
 FlutterInappPurchase.getSubscriptions(skus); /// ఆظߪೖҎ֎ͷ঎඼Λऔಘ
 List<IAPItem> list = await FlutterInappPurchase.getProducts(skus);
 // ߪೖ(ߪೖϑϩʔ΁) PurchasedItem item = await 
 FlutterInappPurchase.buySubscription(productId); PurchasedItem item = await FlutterInappPurchase.buyProduct(productId) // ߪೖޙͷॲཧ 
 // ޙॲཧ await FlutterInappPurchase.endConnection;
 } }
  6. 15 1. flutter_inapp_purchase (How to use) class IAPDataSource {
 void

    sample() async {
 
 await FlutterInappPurchase.initConnection; List<String> skus = []..add(sku);
 /// ఆظߪೖͷ঎඼Λऔಘ
 List<IAPItem> list = await 
 FlutterInappPurchase.getSubscriptions(skus); /// ఆظߪೖҎ֎ͷ঎඼Λऔಘ
 List<IAPItem> list = await FlutterInappPurchase.getProducts(skus);
 // ߪೖ(ߪೖϑϩʔ΁) PurchasedItem item = await 
 FlutterInappPurchase.buySubscription(productId); PurchasedItem item = await FlutterInappPurchase.buyProduct(productId) // ߪೖޙͷॲཧ 
 // ޙॲཧ await FlutterInappPurchase.endConnection;
 } } ίωΫγϣϯ։࢝
  7. 15 1. flutter_inapp_purchase (How to use) class IAPDataSource {
 void

    sample() async {
 
 await FlutterInappPurchase.initConnection; List<String> skus = []..add(sku);
 /// ఆظߪೖͷ঎඼Λऔಘ
 List<IAPItem> list = await 
 FlutterInappPurchase.getSubscriptions(skus); /// ఆظߪೖҎ֎ͷ঎඼Λऔಘ
 List<IAPItem> list = await FlutterInappPurchase.getProducts(skus);
 // ߪೖ(ߪೖϑϩʔ΁) PurchasedItem item = await 
 FlutterInappPurchase.buySubscription(productId); PurchasedItem item = await FlutterInappPurchase.buyProduct(productId) // ߪೖޙͷॲཧ 
 // ޙॲཧ await FlutterInappPurchase.endConnection;
 } } ঎඼औಘ
  8. 15 1. flutter_inapp_purchase (How to use) class IAPDataSource {
 void

    sample() async {
 
 await FlutterInappPurchase.initConnection; List<String> skus = []..add(sku);
 /// ఆظߪೖͷ঎඼Λऔಘ
 List<IAPItem> list = await 
 FlutterInappPurchase.getSubscriptions(skus); /// ఆظߪೖҎ֎ͷ঎඼Λऔಘ
 List<IAPItem> list = await FlutterInappPurchase.getProducts(skus);
 // ߪೖ(ߪೖϑϩʔ΁) PurchasedItem item = await 
 FlutterInappPurchase.buySubscription(productId); PurchasedItem item = await FlutterInappPurchase.buyProduct(productId) // ߪೖޙͷॲཧ 
 // ޙॲཧ await FlutterInappPurchase.endConnection;
 } } ߪೖ
  9. 15 1. flutter_inapp_purchase (How to use) class IAPDataSource {
 void

    sample() async {
 
 await FlutterInappPurchase.initConnection; List<String> skus = []..add(sku);
 /// ఆظߪೖͷ঎඼Λऔಘ
 List<IAPItem> list = await 
 FlutterInappPurchase.getSubscriptions(skus); /// ఆظߪೖҎ֎ͷ঎඼Λऔಘ
 List<IAPItem> list = await FlutterInappPurchase.getProducts(skus);
 // ߪೖ(ߪೖϑϩʔ΁) PurchasedItem item = await 
 FlutterInappPurchase.buySubscription(productId); PurchasedItem item = await FlutterInappPurchase.buyProduct(productId) // ߪೖޙͷॲཧ 
 // ޙॲཧ await FlutterInappPurchase.endConnection;
 } } ߪೖޙͷॲཧ
  10. 15 1. flutter_inapp_purchase (How to use) class IAPDataSource {
 void

    sample() async {
 
 await FlutterInappPurchase.initConnection; List<String> skus = []..add(sku);
 /// ఆظߪೖͷ঎඼Λऔಘ
 List<IAPItem> list = await 
 FlutterInappPurchase.getSubscriptions(skus); /// ఆظߪೖҎ֎ͷ঎඼Λऔಘ
 List<IAPItem> list = await FlutterInappPurchase.getProducts(skus);
 // ߪೖ(ߪೖϑϩʔ΁) PurchasedItem item = await 
 FlutterInappPurchase.buySubscription(productId); PurchasedItem item = await FlutterInappPurchase.buyProduct(productId) // ߪೖޙͷॲཧ 
 // ޙॲཧ await FlutterInappPurchase.endConnection;
 } } ޙॲཧ
  11. 16 1. flutter_inapp_purchase (Pros/Cons) • ϓϥάΠϯଆͰϓϥοτϑΥʔϜͷҧ͍Λٵऩͯ͘͠Εͯ ͍ΔͷͰɺ࢖͏ͱ͖͸ҧ͍Λ͋·Γҙࣝ͠ͳ͍͍ͯ͘ɻ • ͨͩ͠ɺiOS only΍Android

    onlyͳϓϩύςΟ͕͋Δͷ Ͱɺͦ͜͸ҙࣝ͠ͳ͍ͱ͍͚ͳ͍ɻ • Amazon Kindle FireͷΞϓϦ಺՝ۚʹ΋ରԠ • PR͕ͨ͠ɺଈ൓Ԡͯ͘͠ΕͨͷͰ޷ҹ৅ • ͢΂ͯstaticϝιουͳͷͰϞοΫͰ͖ͣςετ͠ʹ͍͘ɻ • Τϥʔ͕iOSɾAndroidͰ౷Ұ͞Ε͍ͯͳ͍ͷͰѻ͍ʹ͘ ͘ɺ෼͔Γʹ͍͘ɻ(ৄࡉ͸Qiitaʹ https://bit.ly/2Fvw0Ig) Pros Cons
  12. 17 2. flutter_billing (Basic) ఆظߪೖ AndroidͷΈՄೳɺiOS͸ෆՄ ఆظߪೖҎ֎ Մೳ Overall score

    88 GitHub star 78 last updated Oct 21, 2018 version 0.3.0 Dart code non-static methods AndroidɺiOS javaɺobj-c
  13. 18 2. flutter_billing (How to use) class IAPDataSource { final

    Billing billing = Billing(onError: (e) { print(e); });
 
 void sample() async { List<String> skus = []..add(sku);
 /// ఆظߪೖͷ঎඼Λऔಘ
 List<BillingProduct> list = await
 billing.getSubscriptions(skus); /// ఆظߪೖҎ֎ͷ঎඼Λऔಘ
 List<BillingProduct> list = await billing.getProducts(skus);
 // ߪೖ(ߪೖϑϩʔ΁) bool result = await billing.subscribe(productId); bool result = await billing.purchase(productId) // ߪೖޙͷॲཧ
 } }
  14. 18 2. flutter_billing (How to use) class IAPDataSource { final

    Billing billing = Billing(onError: (e) { print(e); });
 
 void sample() async { List<String> skus = []..add(sku);
 /// ఆظߪೖͷ঎඼Λऔಘ
 List<BillingProduct> list = await
 billing.getSubscriptions(skus); /// ఆظߪೖҎ֎ͷ঎඼Λऔಘ
 List<BillingProduct> list = await billing.getProducts(skus);
 // ߪೖ(ߪೖϑϩʔ΁) bool result = await billing.subscribe(productId); bool result = await billing.purchase(productId) // ߪೖޙͷॲཧ
 } } ॳظԽ
  15. 18 2. flutter_billing (How to use) class IAPDataSource { final

    Billing billing = Billing(onError: (e) { print(e); });
 
 void sample() async { List<String> skus = []..add(sku);
 /// ఆظߪೖͷ঎඼Λऔಘ
 List<BillingProduct> list = await
 billing.getSubscriptions(skus); /// ఆظߪೖҎ֎ͷ঎඼Λऔಘ
 List<BillingProduct> list = await billing.getProducts(skus);
 // ߪೖ(ߪೖϑϩʔ΁) bool result = await billing.subscribe(productId); bool result = await billing.purchase(productId) // ߪೖޙͷॲཧ
 } } ঎඼औಘ
  16. 18 2. flutter_billing (How to use) class IAPDataSource { final

    Billing billing = Billing(onError: (e) { print(e); });
 
 void sample() async { List<String> skus = []..add(sku);
 /// ఆظߪೖͷ঎඼Λऔಘ
 List<BillingProduct> list = await
 billing.getSubscriptions(skus); /// ఆظߪೖҎ֎ͷ঎඼Λऔಘ
 List<BillingProduct> list = await billing.getProducts(skus);
 // ߪೖ(ߪೖϑϩʔ΁) bool result = await billing.subscribe(productId); bool result = await billing.purchase(productId) // ߪೖޙͷॲཧ
 } } ߪೖ
  17. 18 2. flutter_billing (How to use) class IAPDataSource { final

    Billing billing = Billing(onError: (e) { print(e); });
 
 void sample() async { List<String> skus = []..add(sku);
 /// ఆظߪೖͷ঎඼Λऔಘ
 List<BillingProduct> list = await
 billing.getSubscriptions(skus); /// ఆظߪೖҎ֎ͷ঎඼Λऔಘ
 List<BillingProduct> list = await billing.getProducts(skus);
 // ߪೖ(ߪೖϑϩʔ΁) bool result = await billing.subscribe(productId); bool result = await billing.purchase(productId) // ߪೖޙͷॲཧ
 } } ߪೖޙͷॲཧ
  18. 20 3. iap (Basic) ఆظߪೖ Մೳ ఆظߪೖҎ֎ Մೳ Overall score

    83 GitHub star 11 last updated Nov 28, 2018 version 0.1.0 Dart code non-static methods AndroidɺiOS javaɺobj-c
  19. 21 3. iap (How to use) (Android) class IAPDataSource implements

    PurchasesUpdatedListener {
 BillingClient _client;
 
 void sample() async {
 
 _client = BillingClient(this); await _client.startConnection(onDisconnect: handleDisconnect); List<String> skus = []..add(sku);
 List<SkuDetails> list = await _client.querySkuDetails(
 skuType: SkuType.kSubs, skus: skus); await _client.launchBillingFlow(
 ɹɹɹɹBillingFlowParams(skuDetails: list[0]));
 } 
 @override
 void onPurchasesUpdated(
 ɹɹɹint responseCode, List<Purchase> purchases) {
 ɹ// ߪೖޙͷॲཧ
 }
 }
  20. 21 3. iap (How to use) (Android) class IAPDataSource implements

    PurchasesUpdatedListener {
 BillingClient _client;
 
 void sample() async {
 
 _client = BillingClient(this); await _client.startConnection(onDisconnect: handleDisconnect); List<String> skus = []..add(sku);
 List<SkuDetails> list = await _client.querySkuDetails(
 skuType: SkuType.kSubs, skus: skus); await _client.launchBillingFlow(
 ɹɹɹɹBillingFlowParams(skuDetails: list[0]));
 } 
 @override
 void onPurchasesUpdated(
 ɹɹɹint responseCode, List<Purchase> purchases) {
 ɹ// ߪೖޙͷॲཧ
 }
 } ॳظԽͯ͠ίωΫγϣϯ։࢝
  21. 21 3. iap (How to use) (Android) class IAPDataSource implements

    PurchasesUpdatedListener {
 BillingClient _client;
 
 void sample() async {
 
 _client = BillingClient(this); await _client.startConnection(onDisconnect: handleDisconnect); List<String> skus = []..add(sku);
 List<SkuDetails> list = await _client.querySkuDetails(
 skuType: SkuType.kSubs, skus: skus); await _client.launchBillingFlow(
 ɹɹɹɹBillingFlowParams(skuDetails: list[0]));
 } 
 @override
 void onPurchasesUpdated(
 ɹɹɹint responseCode, List<Purchase> purchases) {
 ɹ// ߪೖޙͷॲཧ
 }
 } ঎඼औಘ
  22. 21 3. iap (How to use) (Android) class IAPDataSource implements

    PurchasesUpdatedListener {
 BillingClient _client;
 
 void sample() async {
 
 _client = BillingClient(this); await _client.startConnection(onDisconnect: handleDisconnect); List<String> skus = []..add(sku);
 List<SkuDetails> list = await _client.querySkuDetails(
 skuType: SkuType.kSubs, skus: skus); await _client.launchBillingFlow(
 ɹɹɹɹBillingFlowParams(skuDetails: list[0]));
 } 
 @override
 void onPurchasesUpdated(
 ɹɹɹint responseCode, List<Purchase> purchases) {
 ɹ// ߪೖޙͷॲཧ
 }
 } ߪೖϑϩʔ΁
  23. 21 3. iap (How to use) (Android) class IAPDataSource implements

    PurchasesUpdatedListener {
 BillingClient _client;
 
 void sample() async {
 
 _client = BillingClient(this); await _client.startConnection(onDisconnect: handleDisconnect); List<String> skus = []..add(sku);
 List<SkuDetails> list = await _client.querySkuDetails(
 skuType: SkuType.kSubs, skus: skus); await _client.launchBillingFlow(
 ɹɹɹɹBillingFlowParams(skuDetails: list[0]));
 } 
 @override
 void onPurchasesUpdated(
 ɹɹɹint responseCode, List<Purchase> purchases) {
 ɹ// ߪೖޙͷॲཧ
 }
 } ߪೖޙͷॲཧ
  24. 22 3. iap (How to use) (iOS) class IAPDataSource implements

    SKPaymentTransactionObserver {
 void sample() async { SKProductsResponse response = await StoreKit.instance.products(skus); await SKPaymentQueue.instance.addPayment( SKPayment.fromMap( {"productIdentifier": sku, "quantity": 1} ) ); StoreKit.instance.paymentQueue .setTransactionObserver(this); @override void didUpdateTransactions( SKPaymentQueue queue, 
 List<SKPaymentTransaction> transactions) async {
 // ߪೖޙͷॲཧ }
 }
 }
  25. 22 3. iap (How to use) (iOS) class IAPDataSource implements

    SKPaymentTransactionObserver {
 void sample() async { SKProductsResponse response = await StoreKit.instance.products(skus); await SKPaymentQueue.instance.addPayment( SKPayment.fromMap( {"productIdentifier": sku, "quantity": 1} ) ); StoreKit.instance.paymentQueue .setTransactionObserver(this); @override void didUpdateTransactions( SKPaymentQueue queue, 
 List<SKPaymentTransaction> transactions) async {
 // ߪೖޙͷॲཧ }
 }
 } ঎඼औಘ
  26. 22 3. iap (How to use) (iOS) class IAPDataSource implements

    SKPaymentTransactionObserver {
 void sample() async { SKProductsResponse response = await StoreKit.instance.products(skus); await SKPaymentQueue.instance.addPayment( SKPayment.fromMap( {"productIdentifier": sku, "quantity": 1} ) ); StoreKit.instance.paymentQueue .setTransactionObserver(this); @override void didUpdateTransactions( SKPaymentQueue queue, 
 List<SKPaymentTransaction> transactions) async {
 // ߪೖޙͷॲཧ }
 }
 } ߪೖ(ߪೖϑϩʔ΁)
  27. 22 3. iap (How to use) (iOS) class IAPDataSource implements

    SKPaymentTransactionObserver {
 void sample() async { SKProductsResponse response = await StoreKit.instance.products(skus); await SKPaymentQueue.instance.addPayment( SKPayment.fromMap( {"productIdentifier": sku, "quantity": 1} ) ); StoreKit.instance.paymentQueue .setTransactionObserver(this); @override void didUpdateTransactions( SKPaymentQueue queue, 
 List<SKPaymentTransaction> transactions) async {
 // ߪೖޙͷॲཧ }
 }
 } ߪೖޙͷॲཧ
  28. 24 4. flutter_payments (Basic) ఆظߪೖ ՄೳΒ͍͠ ఆظߪೖҎ֎ ՄೳΒ͍͠ Overall score

    77 GitHub star 20 last updated Jul 14, 2018 version 0.1.5 Dart code non-static methods AndroidɺiOS kotlinɺswift
  29. 25 4. flutter_payments (How to use) This repository has been

    archived by the owner. It is now read-only !
  30. 25 4. flutter_payments (How to use) This repository has been

    archived by the owner. It is now read-only ! ͦΕͰ΋ࢼͯ͠ΈΑ͏ͱࢥͬͯflutter packges getͨ͠Βɺ failͨ͠ͷͰɺࢼ͢ͷΛఘΊ·ͨ͠ɾɾɾ
  31. 28 5. in_app_purchase (How to use) class IAPDataSource {
 void

    sample() async { ProductDetailsResponse result = await InAppPurchaseConnection.instance .queryProductDetails(skus.toSet()); }
 }
  32. 28 5. in_app_purchase (How to use) class IAPDataSource {
 void

    sample() async { ProductDetailsResponse result = await InAppPurchaseConnection.instance .queryProductDetails(skus.toSet()); }
 } ঎඼औಘ