Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kibelaの決済の仕組み
Search
Michikawa Masayoshi
August 03, 2018
1
730
Kibelaの決済の仕組み
Michikawa Masayoshi
August 03, 2018
Tweet
Share
Featured
See All Featured
A Philosophy of Restraint
colly
203
16k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
What's in a price? How to price your products and services
michaelherold
243
12k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
GraphQLとの向き合い方2022年版
quramy
43
13k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Into the Great Unknown - MozCon
thekraken
32
1.5k
Transcript
KibelaͷܾࡁͷΈ JP_Stripes (Stripe ϢʔβʔάϧʔϓʣTokyo Vol.8 גࣜձࣾϏοτδϟʔχʔ ಓ խՅ - @michiomochi
ಓ խՅ @michiomochi Michikawa Masayoshi ܦྺ 20164݄ Ϗοτδϟʔχʔೖࣾ Kibela։ൃதʂˡ ࠓ͜͜
20144݄ ํσεΫೖࣾ (Cookpadؔ࿈ձࣾ) 2011ʙ ͍ΖΜͳITاۀΛసʑͱ 20094݄ Ϧκʔτೖࣾ (ຊྉཧͬͯ·ͨ͠) גࣜձࣾϏοτδϟʔχʔ
Kibelaͱʁ https://kibe.la
Kibelaͱʁ • ʮݸਓͷൃ৴Λ৫ͷྗʹ͢Δʯͱ͍͏ίϯηϓτͷ ใڞ༗πʔϧ • ओʹձࣾͰΘΕΔ͜ͱΛఆͯ͠࡞͍ͬͯ·͢ • ՈؒͰͷใڞ༗ͱ͍ͯͬͯ͠Δྫ • 5໊·ͰແྉͰ͓͍͍͚ͨͩ·͢
• ͓ؾܰʹ͝ࢼ༻͍ͩ͘͞ʂ • ٕज़ίϛϡχςΟڭҭػؔͷඇӦརஂମͰͷར༻ ਓʹؔΘΒͣແྉͰ͓͍͍͚ͨͩ·͢
None
None
ࠓ͢͜ͱ • KibelaͷྉۚઃܭϙϦγʔ • KibelaͷྉܾۚࡁͷྲྀΕ • ྉܾۚࡁΛͲͷΑ͏ͳΈͰ࣮ݱ͍ͯ͠Δ ͔ • ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢
StripeΛͬͯ৽نSaaSΛ্ཱͪ͛ͨ by @dex1t https://speakerdeck.com/dex1t/kibela-meets-stripe-stripewoshi- tutexin-gui-saaswoli-tishang-getahua-number-jp-stripes
ࠓ͢͜ͱ • KibelaͷྉۚઃܭϙϦγʔ • KibelaͷྉܾۚࡁͷྲྀΕ • ྉܾۚࡁΛͲͷΑ͏ͳΈͰ࣮ݱ͍ͯ͠Δ͔ • ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢
KibelaͷྉۚઃܭϙϦγʔ ͲͷΑ͏ʹߟ͑ྉۚઃܭΛߦ͔ͬͨ
KibelaͷྉۚઃܭϙϦγʔ • ެฏʹ՝ۚ͢Δ • ΞΫηε͕ͳ͍Ϣʔβʔͷར༻ྉٻ͠ͳ͍ • খ͞ͳ৫ΛԠԉ͢Δ • 5໊ҎԼͷνʔϜͣͬͱແྉͰ͑Δ •
ٕज़ίϛϡχςΟڭҭػؔͷඇӦརஂମར༻ਓ ʹؔΘΒͣແྉ • ެฏʹબͯ͠Β͑ΔΑ͏ʹ͢Δ • ଞࣾͱൺֱݕ౼ͯ͠Β͏Α͏ʹ͢Δ ͲͷΑ͏ʹߟ͑ྉۚઃܭΛߦ͔ͬͨ
ࠓ͢͜ͱ • KibelaͷྉۚઃܭϙϦγʔ • ྉܾۚࡁΛͲͷΑ͏ͳΈͰ࣮ݱ͍ͯ͠Δ ͔ • ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢ • KibelaͷྉܾۚࡁͷྲྀΕ
KibelaͷྉܾۚࡁͷྲྀΕ 1. νʔϜͷ࡞ 2. Freeϓϥϯ͔ΒStandardϓϥϯΞοϓάϨʔυ • 2ϲ݄ؒτϥΠΞϧظؒ 3. τϥΠΞϧظ͕ؒऴΘΔͱಉ࣌ʹݱࡏͷϢʔβʔͷྉܾۚ ࡁΛ࣮ߦ
4. ϢʔβʔՃͷʹՃΛཌͷAM 9:00ʹ·ͱΊͯٻ 5. SubscriptionͷకΊ͕͖ͨΒΞΫηεͷͳ͔ͬͨϢʔβʔ ͷྉۚΛKibelaϙΠϯτͰؐݩ 6. 3ʹΓɺҎԼ܁Γฦ͠
ࠓ͢͜ͱ • KibelaͷྉۚઃܭϙϦγʔ • KibelaͷྉܾۚࡁͷྲྀΕ • ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢ • ྉܾۚࡁΛͲͷΑ͏ͳΈͰ࣮ݱ͍ͯ͠Δ͔
ྉܾۚࡁΛͲͷΑ͏ͳΈͰ ࣮ݱ͍ͯ͠Δ͔ ҎԼͷ෦Λհ͠·͢ 4. ϢʔβʔՃͷʹՃΛཌͷAM 9:00ʹ·ͱΊͯٻ 5. SubscriptionͷకΊ͕͖ͨΒΞΫηεͷͳ͔ͬͨϢʔβʔ ͷྉۚΛKibelaϙΠϯτͰؐݩ 1.
νʔϜͷ࡞ 2. Freeϓϥϯ͔ΒStandardϓϥϯΞοϓάϨʔυ 3. τϥΠΞϧظ͕ؒऴΘΔͱಉ࣌ʹݱࡏͷϢʔβʔͷྉܾۚ ࡁΛ࣮ߦ 6. 3ʹΓɺҎԼ܁Γฦ͠
ϢʔβʔՃͷʹՃΛཌͷAM 9:00ʹ ·ͱΊͯٻ ͦͦͳͥ͜Μͳ͜ͱΛ͍ͯ͠Δͷ͔ • KibelaϢʔβʔʹΑΓٻֹ͕มΘΔ • ͭ·Γैྔ՝ۚͷαʔϏε • Ωϟογϡϑϩʔతʹɺ·ͨऔΓͬͺ͙ΕϦεΫΛճආ͢Δ
ͨΊʹઌ͍ʹ͍ͨ͠ • Ωϟογϡϑϩʔత = ͓͕ۚग़དྷΔ͚ͩૣ͘ೖ͖ͬͯͯ΄ ͍͠ • খ͍͞ձࣾʹͱͬͯݱۚΛૣ͘ड͚औΕΔͷඇৗʹେࣄ • ैྔ՝ۚαʔϏεͰઌ͍ʹ͢Δͷ͕ඞཁ
ϢʔβʔՃͷʹՃΛཌͷAM 9:00ʹ ·ͱΊͯٻ • Ϣʔβʔ࡞ͱಉ࣌ʹݱࡏͷPlanͱಉ͡ٻֹͷInvoiceItem Λ࡞ • InvoiceItem࡞͚ͨͩ͠Ͱܾࡁ͞Εͳ͍ • ຖAM
9:00ʹInvoiceItem͕ͳ͍͔֬ೝ͠ɺ͋ΕInvoiceΛ ࡞͢ΔόονΛ࣮ߦ͢Δ • όονͷ࣮ߦʹKuroko2Λ࠾༻ • Invoice͕࡞͞ΕΔͱStripeଆͰҰఆ࣌ؒޙʹܾࡁ͕ߦΘΕ Δ ࣮ݱͷ͔ͨ͠
ϢʔβʔՃͷʹՃΛཌͷAM 9:00ʹ ·ͱΊͯٻ
• web-based job scheduler / workflow engine. • ҰݴͰ͍͏ͱ͍͢͝cron •
δϣϒͷ࣮ߦΛ͏·͍۩߹ʹͬͯ͘ΕΔ • δϣϒͷ࣮ߦ։࢝ɺޭɺࣦഊΛϝʔϧSlackͰ௨͢ Δػೳ͕͋Δ • Web UI͕͋Δ • Web্Ͱδϣϒͷઃఆɺࣦഊͨ͠δϣϒͷϦτϥΠ͕Ͱ͖Δ • ܾࡁͷॏཁͳjobcronͰ࣮ߦ͢Δͷ৺ڐͳ͍ https://github.com/cookpad/kuroko2
https://github.com/cookpad/kuroko2
https://github.com/cookpad/kuroko2
ྉܾۚࡁΛͲͷΑ͏ͳΈͰ ࣮ݱ͍ͯ͠Δ͔ ҎԼͷ෦Λհ͠·͢ 5. SubscriptionͷకΊ͕͖ͨΒΞΫηεͷͳ͔ͬͨϢʔβʔ ͷྉۚΛKibelaϙΠϯτͰؐݩ 1. νʔϜͷ࡞ 2. Freeϓϥϯ͔ΒStandardϓϥϯΞοϓάϨʔυ
3. τϥΠΞϧظ͕ؒऴΘΔͱಉ࣌ʹݱࡏͷϢʔβʔͷྉܾۚ ࡁΛ࣮ߦ 4. ϢʔβʔՃͷʹՃΛཌͷAM 9:00ʹ·ͱΊͯٻ 6. 3ʹΓɺҎԼ܁Γฦ͠
KibelaͷྉۚઃܭϙϦγʔ • খ͞ͳ৫ΛԠԉ͢Δ • 5໊ҎԼͷνʔϜͣͬͱແྉͰ͑Δ • ٕज़ίϛϡχςΟڭҭػؔͷඇӦརஂମར ༻ਓʹؔΘΒͣແྉ • ެฏʹબͯ͠Β͑ΔΑ͏ʹ͢Δ
• ଞࣾͱൺֱݕ౼ͯ͠Β͏Α͏ʹ͢Δ ͲͷΑ͏ʹߟ͑ྉۚઃܭΛߦ͔ͬͨ • ެฏʹ՝ۚ͢Δ • ΞΫηε͕ͳ͍Ϣʔβʔͷར༻ྉٻ͠ͳ͍
SubscriptionͷకΊ͕͖ͨΒΞΫηεͷͳ͔ͬ ͨϢʔβʔͷྉۚΛKibelaϙΠϯτͰؐݩ • StripeʹAccount Balanceͱ͍͏ػೳ͕͋Δ • ܾࡁ͕ߦΘΕΔࡍʹ༏ઌతʹΘΕΔΫϨδοτ • KibelaϙΠϯτ =
Account Balance • SubscriptionͷకΊ͕͖ͯInvoice͕࡞͞ΕͨࡍʹStripe͔ ΒInvoice.created Webhook͕ඈΜͰ͘Δ • Invoice࡞͞Ε͙ܾͯ͢ࡁ͕࣮ߦ͞ΕΔΘ͚Ͱͳ͍ • ܾࡁ͕࣮ߦ͞ΕΔલʹInvoice.createdΛhookͯ͠Account BalanceΛ༩͢Δ ࣮ݱͷ͔ͨ͠
ࠓ͢͜ͱ • KibelaͷྉۚઃܭϙϦγʔ • KibelaͷྉܾۚࡁͷྲྀΕ • ྉܾۚࡁΛͲͷΑ͏ͳΈͰ࣮ݱ͍ͯ͠Δ ͔ • ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢
ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢ ͳΜͰʁ • ·ͩΫϨδοτΧʔυΛ͑ͳ͍ձࣾੈͷதʹͨ͘͞Μ͋ Δ • ελʔτΞοϓΫϨδοτΧʔυΛ͑Δͱ͜Ζଟ͍ • ੲ͔Β͋Δେ͖ͳاۀ͑ͳ͍ͱ͜Ζଟ͍ •
ΫϨδοτΧʔυΛ͑ͳ͍ձࣾ ≒ େ͖ͳձࣾ ͳͷͰ͜͜Λ औΕΔ͜ͱച্ʹେ͖͘ܨ͕Δ • ͭΒͯ͘Δ͔͠ͳ͍
ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢ ࣮ݱํ๏ खಈ…ʁ
ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢
ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢ Docs: https://stripe.com/docs/billing/invoices
ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢ ࣮ݱํ๏ • SubscriptionͷbillingઃఆΛAutomatically ʙ͔ΒEmail ʙมߋ͢Δ • ܾࡁํ๏(ΫϨδοτΧʔυ)͕ొ͞Ε͍ͯͳͯ͘༗ྉProduct มߋͰ͖ΔΑ͏ʹͳΔ •
ࣗಈͰܾࡁ͕ߦΘΕͳ͘ͳΔ • SubscriptionͷకΊʹͳΔͱInvoice͕࡞͞ΕΔ • ࡞͞ΕͨInvoiceΛݟͯٻॻΛ࡞͓͠٬༷ૹ • Stripe͔ΒϝʔϧͰૹΔ͜ͱ͕Ͱ͖Δ • ͕ɺॻྨͰ͘Εͱ͍͏ͱ͜Ζ͋Γͦ͏… • ৼΓࠐ·Ε͔ͨΛۜߦޱ࠲Λݟͯ֬ೝ • खಈʁ • ৼΓࠐ·Ε͍ͯͨΒInvoiceΛMark as paid
ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢
ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢ ͍͍ͱ͜Ζ • ٻॻ͍ʹؔͯ͠Stripe্ཧ͕ग़དྷΔ • ாථ͕StripeͰҰݩཧͰ͖Δ • ͜Ε͕ग़དྷͳ͍ͱStripeͱผͰཧ͢Δඞཁ͕͋ΓͭΒ͍ͱ͜Ζ ͩͬͨ ͳΜͱ͔͍ͨ͠ͱ͜Ζ
• ݱঢ়ɺۜߦʹৼΓࠐ·Εͨ͜ͱͷ֬ೝ͕खಈ͔͠ͳ͍ʁ • billingઃఆ͕Email ʙͷInvoice͕࡞͞Εͨ͜ͱΛͪ͜Β͕ݕ͢Δ ํ๏ • Slack௨ͱ͔͋Δͱخ͍͚͠Ͳ…
ࠓͨ͜͠ͱ • KibelaͷྉۚઃܭϙϦγʔ • KibelaͷྉܾۚࡁͷྲྀΕ • ྉܾۚࡁΛͲͷΑ͏ͳΈͰ࣮ݱ͍ͯ͠Δ ͔ • ٻॻ͍ʹରԠ͠Α͏ͱ͍ͯ͠·͢
͍͞͝ʹ ϏοτδϟʔχʔΤϯδχΞΛେืूதͰ͢ʂʂʂ ҰॹʹKibelaΛ࡞Γ·ͤΜ͔ʁ ڵຯ͕͋Δํ࠙ձͰ͔͚ͯ͠Β͑Δͱ͏Ε ͍͠Ͱ͢ʂ