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

iOSDC 20190906: 動画アプリの投げ銭機能における
消耗型課金の仕組みと実装

Takeshi Ihara
September 06, 2019

iOSDC 20190906: 動画アプリの投げ銭機能における
消耗型課金の仕組みと実装

Takeshi Ihara

September 06, 2019
Tweet

More Decks by Takeshi Ihara

Other Decks in Programming

Transcript

  1. Takeshi Ihara • 2018.09.01 AbemaTV Join • 2018.09.02 iOSDC 2018

    LT ʮখ͘͞͸͡ΊΔ୺຤؅ཧʯ • ϘϧμϦϯάͱ֨ಆήʔϜ͕झຯ • https://twitter.com/nonchalant0303
  2. ՝ۚܗࣜ • ফ໣ܕ (Consumable) - ΞϓϦ಺௨՟ͳͲ Ұ౓࢖͏ͱͳ͘ͳΓɺ࠶ߪೖ͢Δ͜ͱ͕Ͱ͖Δ
 • ඇফ໣ܕ (Non-Consumable)

    - ޿ࠂͷඇදࣔͳͲ Ұ౓ͷߪೖ͚ͩͰແ੍ݶʹ࢖༻Ͱ͖Δ • ࣗಈߋ৽αϒεΫϦϓγϣϯ (Auto-Renewable Subscriptions) - ֹ݄VODͳͲ ݄ؒαʔϏε΍ఆظతʹΞοϓσʔτ͞ΕͨίϯςϯπΛߪೖ͢Δ͜ͱ͕Ͱ͖Δ • ඇߋ৽αϒεΫϦϓγϣϯ (Non-Renewing Subscriptions) - γʔζϯύεͳͲ ظؒݶఆͷαʔϏε΍ίϯςϯπΛߪೖ͢Δ͜ͱ͕Ͱ͖Δ
  3. ՝ۚܗࣜʹΑΔػೳͷҧ͍ ࠶ߪೖͷՄ൱ Ϩγʔτ΁ͷදࣔ σόΠεؒͰͷಉ ظ ෮ݩ ফ໣ܕ ˓
 Կ౓Ͱ΋ ࠶ߪೖ·Ͱ

    ಉظͳ͠ ෮ݩ͞Εͳ͍ ඇফ໣ܕ ✖ ৗʹ γεςϜʹΑΓಉ ظ γεςϜʹΑΓಉ ظ ࣗಈߋ৽
 αϒεΫϦϓγϣ ϯ ✖
 ࣗಈతʹߋ৽͞Ε Δ ৗʹ γεςϜʹΑΓಉ ظ γεςϜʹΑΓಉ ظ ඇߋ৽αϒεΫϦ ϓγϣϯ ˓ ߋ৽͢Δ ৗʹ "QQʹΑΓಉظ "QQʹΑΓಉظ https://developer.apple.com/jp/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Products.html#//apple_ref/doc/uid/TP40008267-CH2-SW2 https://developer.apple.com/jp/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Restoring.html#//apple_ref/doc/uid/TP40008267-CH8-SW9
  4. ՝ۚܗࣜʹΑΔػೳͷҧ͍ ࠶ߪೖͷՄ൱ Ϩγʔτ΁ͷදࣔ σόΠεؒͰͷಉ ظ ෮ݩ ফ໣ܕ ˓
 Կ౓Ͱ΋ ࠶ߪೖ·Ͱ

    ಉظͳ͠ ෮ݩ͞Εͳ͍ ඇফ໣ܕ ✖ ৗʹ γεςϜʹΑΓಉ ظ γεςϜʹΑΓಉ ظ ࣗಈߋ৽
 αϒεΫϦϓγϣ ϯ ✖
 ࣗಈతʹߋ৽͞Ε Δ ৗʹ γεςϜʹΑΓಉ ظ γεςϜʹΑΓಉ ظ ඇߋ৽αϒεΫϦ ϓγϣϯ ˓ ߋ৽͢Δ ৗʹ "QQʹΑΓಉظ "QQʹΑΓಉظ https://developer.apple.com/jp/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Products.html#//apple_ref/doc/uid/TP40008267-CH2-SW2 https://developer.apple.com/jp/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Restoring.html#//apple_ref/doc/uid/TP40008267-CH8-SW9
  5. { "receipt": { …, "in_app": [ { "product_id": “com.nonchalant.consumable1”, "transaction_id":

    "1000000551439498", "purchase_date": "2019-09-01 00:00:00 Etc/GMT”, … } ] } } Ϩγʔτ (ॳճߪೖ࣌) https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW1
  6. { "receipt": { …, "in_app": [ { "product_id": “com.nonchalant.consumable1", "transaction_id":

    "1000000556349963", "purchase_date": "2019-09-03 10:10:26 Etc/GMT”, … } ] } } Ϩγʔτ (࠶ߪೖ࣌) https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW1
  7. ՝ۚτϥϯβΫγϣϯͷѻ͍ͷ஫ҙ఺ • ΠϯηϯςΟϒΛ෇༩͢Δ·ͰτϥϯβΫγϣϯΛऴྃͯ͠͸͍͚ͳ͍ > Once you’ve delivered the product, your

    application must call finishTransaction: to complete the transaction. When you call finishTransaction:, the transaction is removed from the payment queue. To ensure that products are not lost, your application should deliver the product before calling finishTransaction:. • ߪೖཤྺ͕Ϩγʔτʹৗʹදࣔ͞ΕΔ՝ۚܗࣜͰ͸
 ҙࣝ͠ͳͯ͘΋໰୊ͳ͍ ඇফ໣ܕɺࣗಈߋ৽αϒεΫϦϓγϣϯɺඇߋ৽αϒεΫϦϓγϣϯ https://www.rapid-ideas.com/previews/wsa/page9/files/StoreKitGuide.pdf
  8. ফ໣ܕ՝ۚͷߪೖϑϩʔ 4. ϨγʔτݕূϦΫΤετ 5. Ϩγʔτݕূ݁Ռ 6. AbemaίΠϯ
 ෇༩ App Store

    AbemaTV iOS AbemaTV Server 7. ׬ྃϨεϙϯε (201) 1. ߪೖϦΫΤετ
 (τϥϯβΫγϣϯͷ։࢝) 8. τϥϯβΫγϣϯ
 ͷऴྃ 2. ߪೖ׬ྃ 3. Ϩγʔτૹ৴
  9. ফ໣ܕ՝ۚͷߪೖϑϩʔ 4. ϨγʔτݕূϦΫΤετ 5. Ϩγʔτݕূ݁Ռ 6. AbemaίΠϯ
 ෇༩ App Store

    AbemaTV iOS AbemaTV Server 7. ׬ྃϨεϙϯε (201) 1. ߪೖϦΫΤετ
 (τϥϯβΫγϣϯͷ։࢝) 8. τϥϯβΫγϣϯ
 ͷऴྃ 2. ߪೖ׬ྃ 3. Ϩγʔτૹ৴
  10. ফ໣ܕ՝ۚͷߪೖϑϩʔ 4. ϨγʔτݕূϦΫΤετ 5. Ϩγʔτݕূ݁Ռ 6. AbemaίΠϯ
 ෇༩ App Store

    AbemaTV iOS AbemaTV Server 7. ׬ྃϨεϙϯε (201) 1. ߪೖϦΫΤετ
 (τϥϯβΫγϣϯͷ։࢝) 8. τϥϯβΫγϣϯ
 ͷऴྃ 2. ߪೖ׬ྃ 3. Ϩγʔτૹ৴
  11. ফ໣ܕ՝ۚͷߪೖϑϩʔ 4. ϨγʔτݕূϦΫΤετ 5. Ϩγʔτݕূ݁Ռ 6. AbemaίΠϯ
 ෇༩ App Store

    AbemaTV iOS AbemaTV Server 7. ׬ྃϨεϙϯε (201) 1. ߪೖϦΫΤετ
 (τϥϯβΫγϣϯͷ։࢝) 8. τϥϯβΫγϣϯ
 ͷऴྃ 2. ߪೖ׬ྃ 3. Ϩγʔτૹ৴
  12. ফ໣ܕ՝ۚͷߪೖϑϩʔ 4. ϨγʔτݕূϦΫΤετ 5. Ϩγʔτݕূ݁Ռ 6. AbemaίΠϯ
 ෇༩ App Store

    AbemaTV iOS AbemaTV Server 7. ׬ྃϨεϙϯε (201) 1. ߪೖϦΫΤετ
 (τϥϯβΫγϣϯͷ։࢝) 8. τϥϯβΫγϣϯ
 ͷऴྃ 2. ߪೖ׬ྃ 3. Ϩγʔτૹ৴
  13. ফ໣ܕ՝ۚͷߪೖϑϩʔ 4. ϨγʔτݕূϦΫΤετ 5. Ϩγʔτݕূ݁Ռ 6. AbemaίΠϯ
 ෇༩ App Store

    AbemaTV iOS AbemaTV Server 7. ׬ྃϨεϙϯε (201) 1. ߪೖϦΫΤετ
 (τϥϯβΫγϣϯͷ։࢝) 8. τϥϯβΫγϣϯ
 ͷऴྃ 2. ߪೖ׬ྃ 3. Ϩγʔτૹ৴
  14. ফ໣ܕ՝ۚͷߪೖϑϩʔ 4. ϨγʔτݕূϦΫΤετ 5. Ϩγʔτݕূ݁Ռ 6. AbemaίΠϯ
 ෇༩ App Store

    AbemaTV iOS AbemaTV Server 7. ׬ྃϨεϙϯε (201) 1. ߪೖϦΫΤετ
 (τϥϯβΫγϣϯͷ։࢝) 8. τϥϯβΫγϣϯ
 ͷऴྃ 2. ߪೖ׬ྃ 3. Ϩγʔτૹ৴
  15. ফ໣ܕ՝ۚͷߪೖϑϩʔ 4. ϨγʔτݕূϦΫΤετ 5. Ϩγʔτݕূ݁Ռ 6. AbemaίΠϯ
 ෇༩ App Store

    AbemaTV iOS AbemaTV Server 7. ׬ྃϨεϙϯε (201) 1. ߪೖϦΫΤετ
 (τϥϯβΫγϣϯͷ։࢝) 8. τϥϯβΫγϣϯ
 ͷऴྃ 2. ߪೖ׬ྃ 3. Ϩγʔτૹ৴
  16. ফ໣ܕ՝ۚͷߪೖϑϩʔ 4. ϨγʔτݕূϦΫΤετ 5. Ϩγʔτݕূ݁Ռ 6. AbemaίΠϯ
 ෇༩ App Store

    AbemaTV iOS AbemaTV Server 7. ׬ྃϨεϙϯε (201) 1. ߪೖϦΫΤετ
 (τϥϯβΫγϣϯͷ։࢝) 8. τϥϯβΫγϣϯ
 ͷऴྃ 3. Ϩγʔτૹ৴ 2. ߪೖ׬ྃ
  17. ՝ۚ׬ྃޙʹࣦഊ͢Δέʔε 1 4. ϨγʔτݕূϦΫΤετ 5. Ϩγʔτݕূ݁Ռ 6. AbemaίΠϯ
 ෇༩ App

    Store AbemaTV iOS AbemaTV Server 7. ׬ྃϨεϙϯε (201) 1. ߪೖϦΫΤετ
 (τϥϯβΫγϣϯͷ։࢝) 8. τϥϯβΫγϣϯ
 ͷऴྃ 3. Ϩγʔτૹ৴ 2. ߪೖ׬ྃ
  18. ՝ۚ׬ྃޙʹࣦഊ͢Δέʔε 2 4. ϨγʔτݕূϦΫΤετ 5. Ϩγʔτݕূ݁Ռ 6. AbemaίΠϯ
 ෇༩ App

    Store AbemaTV iOS AbemaTV Server 7. ׬ྃϨεϙϯε (201) 1. ߪೖϦΫΤετ
 (τϥϯβΫγϣϯͷ։࢝) 8. τϥϯβΫγϣϯ
 ͷऴྃ 2. ߪೖ׬ྃ 3. Ϩγʔτૹ৴
  19. AbemaίΠϯະ෇༩ͷϦτϥΠ 3. ϨγʔτݕূϦΫΤετ 4. Ϩγʔτݕূ݁Ռ 5. AbemaίΠϯ
 ෇༩ App Store

    AbemaTV iOS AbemaTV Server 6. ׬ྃϨεϙϯε (201) 7. τϥϯβΫγϣϯ
 ͷऴྃ 2. Ϩγʔτૹ৴ 1. ະ׬ྃτϥϯβΫγϣϯͷऔಘ
 (SKPaymentQueue.transactions)
  20. AbemaίΠϯະ෇༩ͷϦτϥΠ 3. ϨγʔτݕূϦΫΤετ 4. Ϩγʔτݕূ݁Ռ 5. AbemaίΠϯ
 ෇༩ App Store

    AbemaTV iOS AbemaTV Server 6. ׬ྃϨεϙϯε (201) 7. τϥϯβΫγϣϯ
 ͷऴྃ 2. Ϩγʔτૹ৴ 1. ະ׬ྃτϥϯβΫγϣϯͷऔಘ
 (SKPaymentQueue.transactions)
  21. AbemaίΠϯ෇༩ࡁΈͷϦτϥΠ 3. ϨγʔτݕূϦΫΤετ 4. Ϩγʔτݕূ݁Ռ App Store AbemaTV iOS AbemaTV

    Server 5. AbemaίΠϯ෇༩ࡁΈΤϥʔ (409) 6. τϥϯβΫγϣϯ
 ͷऴྃ 2. Ϩγʔτૹ৴ 1. ະ׬ྃτϥϯβΫγϣϯͷऔಘ
 (SKPaymentQueue.transactions)
  22. AbemaίΠϯ෇༩ࡁΈͷϦτϥΠ 3. ϨγʔτݕূϦΫΤετ 4. Ϩγʔτݕূ݁Ռ App Store AbemaTV iOS AbemaTV

    Server 5. AbemaίΠϯ෇༩ࡁΈΤϥʔ (409) 6. τϥϯβΫγϣϯ
 ͷऴྃ 2. Ϩγʔτૹ৴ 1. ະ׬ྃτϥϯβΫγϣϯͷऔಘ
 (SKPaymentQueue.transactions)
  23. AbemaίΠϯ෇༩ࡁΈͷϦτϥΠ 3. ϨγʔτݕূϦΫΤετ 4. Ϩγʔτݕূ݁Ռ App Store AbemaTV iOS AbemaTV

    Server 5. AbemaίΠϯ෇༩ࡁΈΤϥʔ (409) 6. τϥϯβΫγϣϯ
 ͷऴྃ 2. Ϩγʔτૹ৴ 1. ະ׬ྃτϥϯβΫγϣϯͷऔಘ
 (SKPaymentQueue.transactions)