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

Stripe Connect を使ったサービス構築の裏側

Stripe Connect を使ったサービス構築の裏側

Stripe Connect を使ったサービス構築の裏側

Takayuki
PRO

April 20, 2020
Tweet

More Decks by Takayuki

Other Decks in Programming

Transcript

  1. Stripe Connect Λ࢖ͬͨαʔϏε
    ߏஙͷཪଆ

    View Slide

  2. 1 ձࣾ঺հɾࣗݾ঺հ
    2 Stripeಋೖʹࢸͬͨഎܠ
    Agenda
    3 Stripe ConnectΛಋೖ͢ΔϝϦοτ
    4 ࣮૷ํ๏ɾಋೖͯ͠Έͯؾ͍ͮͨ͜ͱ

    View Slide

  3. 1 ձࣾ঺հɾࣗݾ঺հ

    View Slide

  4. 4
    ࣗݾ঺հ
    ◆໊લ
    ླ໦ ޹೭(Suzuki Takayuki)
    ※ಉ੏ಉ໊ଟͯ͘ࠔͬͯ·͢ɻɻɻ
    ◆ࣗݾ঺հ
    ɾ1990೥ɺਆಸ઒ݝੜ·Εɻ
    ɾࣾձਓʹͳ͔ͬͯΒɺϓϩάϥϛϯάΛ࢝ΊΔɻ
    ɾ2015೥ʹϑϧεϐʔυʹೖࣾ͠ɺ2017೥ʹಠཱɻ
    ɾϑϦʔϥϯεͰϦϞʔτϫʔΫΛ൒೥΍ͬͨޙʹԭೄͰى
    ۀ
    ◆झຯ
    ίεϓϨɺԻָϥΠϒɺϚϥιϯେձʹग़Δɺ໺ٿ؍ઓ
    JP_StripesԭೄΛӡӦͯ͠·͢ʂ
    BDD(Ϗʔνۦಈ։ൃ)

    View Slide

  5. Copyright Re:Build.inc All Rights Reserved.
    ࣗݾ঺հ

    View Slide

  6. Copyright Re:Build.inc All Rights Reserved.
    1.ձࣾ঺հ
    ◆ձ໊ࣾ
    גࣜձࣾRe:Build
    ◆ॅॴ
    ԭೄݝಹ೼ࢢٱໜ஍2-2-2 λΠϜεϏϧ
    ◆ࣄۀ಺༰
    ɾࣗࣾWEBαʔϏεͷاըɾ։ൃɻ
    ɾडୗ։ൃ
    ◆ࣾһ
    7໊
    ◆ΤϯδχΞͷಇ͖ํ
    ϦϞʔτϫʔΫՄೳͳࣗ༝ͳಇ͖ํΛਪ঑ͯ͠·͢ʂ

    View Slide

  7. 2 Stripeಋೖʹࢸͬͨഎܠ

    View Slide

  8. 8
    ࣗࣾWebαʔϏεͷ։ൃ
    ɾαʔϏε໊
    Tadoru
    ɾγεςϜ֓ཁ
    Ϋϥ΢υιʔγϯά
    ΫϨδοτܾࡁ
    ͳͲ
    ɾ࢖͍ͬͯΔٕज़
    ݴޠ : PHP,JavaScript
    ϑϨʔϜϫʔΫ: laravel5,Nuxt.jsͳͲ

    View Slide

  9. Re:Build
    اۀͷ୲౰ऀ͕
    ΤʔδΣϯτΛબͿ
    ΤʔδΣϯτ͕ࣗ෼ͷܨ
    ͕Γͷ͋ΔΤϯδχΞ·
    ͨ͸νʔϜʹ੠Λ͔͚Δ
    ࢓ࣄͷۭ͖͕͋Δϫʔ
    Χʔ͕͍Ε͹ɺ໘઀Λߦ
    ͏
    ΤʔδΣϯτ͸
    ࣄલʹ৹੍ࠪ
    ΤϯδχΞνʔϜ
    ΤϯδχΞ
    ϫʔΧʔ
    ΤʔδΣϯτ
    اۀ
    ϏδωεϞσϧ
    ࠾༻ใु

    View Slide

  10. 1 0
    ཁ݅
    ɾܾࡁΛϓϥοτϑΥʔϜ্Ͱߦ͏ɻ
    ɾۜߦৼࠐ͸໘౗ͳͷͰɺϓϥοτ
    ϑΥʔϜ্Ͱ͓ۚͷ΍ΓऔΓΛ׬݁ͤ͞
    ͍ͨɻ

    View Slide

  11. 3 Stripe ConnectΛಋೖ͢ΔϝϦοτ

    View Slide

  12. 1 2
    Stripe Connectͱ͸
    ɾCustomerʢސ٬ʣ:
    ߪೖऀͰ͋Γ͓ۚΛࢧ෷͏ํɻӈͷਤ
    Ͱ྘ɻ
    ɾPlatformʢϓϥοτϑΥʔϜʣ:
    ͦͷ໊ͷ௨ΓϓϥοτϑΥʔϜΛఏڙ
    ͢Δํɻӈͷਤͷ੨ɻ
    ɾConnected accounts:
    ϓϥοτϑΥʔϜΛར༻ͯ͠αʔϏε
    Λఏڙ͠ɺೖۚΛड͚ΔํʢࢠΞΧ΢
    ϯτͱ΋ݺ͹Ε·͢ʣɻӈͷਤͷϐϯ
    Ϋɻ
    ࢀߟɿhttps://qiita.com/y_toku/items/7bfa42793801dfc5415d

    View Slide

  13. 1 3
    Stripe Connectͱ͸
    ΤʔδΣϯτ
    Tadoru
    اۀ

    View Slide

  14. 1 4
    ܾࡁର৅
    اۀ
    ʢCustomerʣ
    ΤʔδΣϯτ
    ʢࢠΞΧ΢ϯτʣ
    ʢϓϥοτϑΥʔϜʣ
    ஥հख਺ྉ
    Ϛονϯά࣌ͷใु
    BtoCϞσϧ

    View Slide

  15. 1 5
    ϝϦοτ
    ॊೈͳΧελϚΠζػೳ
    Connect ͷڧΈ͸ API ɻϓϥοτ
    ϑΥʔϜͷ࠷దͳΤΫεϖϦΤϯεΛσ
    βΠϯͰ͖·͢ɻϢʔβొ࿥ϑϩʔͷΧ
    ελϚΠζ΍ɺೖۚαΠΫϧͷઃఆɺෳ
    ࡶͳࢿۚҠಈͷΧελϚΠζॲཧɺ౷߹
    ͞ΕͨܦཧϨϙʔςΟϯάػೳɻ
    ਝ଎ʹಋೖͰ͖Δ
    ϓϥοτϑΥʔϜͷͨΊͷܾࡁΠϯϑ
    ϥετϥΫνϟߏஙͰɺ͢Ͱʹ׬੒͞
    Εͨ UI ཁૉΛऔΓೖΕͯɺϩʔϯνΛ
    εϐʔυΞοϓɺΦϖϨʔγϣϯΛγϯ
    ϓϧʹͰ͖·͢ɻ
    άϩʔόϧల։͠΍͍͢
    ੈք 25ΧࠃҎ্ͷചΓख΁ࢧ෷͍Մ
    ೳɻϚʔέοτ͝ͱͷݱ஍ࢠձࣾ΍
    ۜߦ࿈ܞ͸ඞཁ͋Γ·ͤΜɻෳࡶͳ
    ॲཧ͸ Connect ͕Ҿ͖ड͚·͢ɻ
    1 2 3
    https://stripe.com/connect

    View Slide

  16. 4 ࣮૷ํ๏ɾಋೖͯ͠Έͯؾ͍ͮͨ͜ͱ

    View Slide

  17. ϑϩϯτΤϯυ αʔόαΠυ
    શମߏ੒
    Gitlab CI
    ϥΠϒϥϦͳͲ
    Firebase
    ϥΠϒϥϦͳͲ

    View Slide

  18. શମͷΞʔΩςΫνϟ(̐ͭͷυϝΠϯผ)
    ϑϩϯτΤϯυ αʔόαΠυ
    blade
    MPAߏ੒
    ϑϩϯτΤϯυ αʔόαΠυ
    SPAߏ੒
    αʔόαΠυ
    ϑϩϯτΤϯυ αʔόαΠυ
    blade
    MPAߏ੒
    ϫʔΧʔը໘ ΤʔδΣϯτը໘
    اۀը໘
    SPAߏ੒
    ϑϩϯτΤϯυ
    ӡӦը໘
    MPA
    SPA

    View Slide

  19. 1 9
    ͔͔ͬͨ޻਺
    ɾλυϥʔը໘(Laravel)
    - 5೔͘Β͍

    ɾاۀ؅ཧը໘(Nuxt.js)
    - 3೔͘Β͍
    ɾεέδϡʔϧײ
    ߹ܭ2िؒऑ͘Β͍

    View Slide

  20. 2 0
    اۀଆͷ࣮૷಺༰
    ɾ࣮૷ͨ͠ػೳ
    - ΫϨδοτΧʔυͷొ࿥
    - ܾࡁͷ࣮ߦ
    ɾ࢖ͬͨϥΠϒϥϦ
    https://stripe.com/docs/stripe-js/reference

    View Slide

  21. 2 1
    اۀଆͷ࣮૷಺༰

    View Slide

  22. 2 2
    اۀଆͷ࣮૷಺༰

    View Slide

  23. 2 3
    اۀଆͷ࣮૷಺༰

    View Slide

  24. 2 4
    اۀଆͷ࣮૷಺༰

    View Slide

  25. 2 5
    اۀଆͷ࣮૷಺༰

    View Slide

  26. 2 6
    اۀଆͷ࣮૷಺༰

    View Slide

  27. 2 7
    ΤʔδΣϯτଆͷ࣮૷಺༰
    ɾ࣮૷ͨ͠ػೳ
    - ΞΧ΢ϯτ৘ใ
    ※2~3೔ͷ৹͕ࠪ͋Δ
    - ޱ࠲৘ใͷొ࿥
    ɾ࢖ͬͨϥΠϒϥϦ
    https://github.com/stripe/stripe-php

    View Slide

  28. 2 8
    ΤʔδΣϯτଆͷ࣮૷಺༰

    View Slide

  29. 2 9
    ৹ࠪͷΠϝʔδ
    ޱ࠲৘ใ΍ূ໌ॻͷొ࿥
    ̎ʙ̏೔Ͱ݁Ռ͕͘Δ

    View Slide

  30. 3 0
    ΤʔδΣϯτଆͷ࣮૷಺༰

    View Slide

  31. 3 1
    ؅ཧը໘ͷݟ͑ํ

    View Slide

  32. 3 2
    ࣮૷Ͱେมͩͬͨ͜ͱ
    ɾStripeͷࢠΞΧ΢ϯτΛ࡞Δࡍʹೖྗ߲໨͕ଟ͍
    ɾຊਓ֬ೝνΣοΫͷεςʔλε֬ೝΛ͢Δඞཁ͕͋Δ
    - APIΛݺ΂͹ɺঝೝࡁΈ͔৹ࠪத͕Θ͔Δ
    - webhookͰSlack΍ϝʔϧʹඈ͹͢͸Մೳ

    View Slide

  33. 3 3
    ಋೖͯ͠Έͯؾ͍ͮͨ͜ͱ
    ϫʔΧʔͱͯ͠
    ϩάΠϯ
    λυϥʔਃ੥
    (1िؒఔ౓Ͱࣄ຿ہ
    ΑΓ৹ࠪ݁ՌΛϝʔ
    ϧ௨஌)
    ৼΓࠐΈޱ࠲ొ࿥ ൃ஫اۀʹ૬ஊ͞
    ΕͨҊ݅Λ
    ϫʔΧʔʹ঺հ
    STEP1 STEP2 STEP3 STEP4
    01 02 03 04
    ΤʔδΣϯτͷొ࿥ϑϩʔ͕௕ͯ͘཭୤͕ଟ͔ͬͨɻɻɻ

    View Slide

  34. 3 4
    ಋೖͯ͠Έͯؾ͍ͮͨ͜ͱ
    ΤʔδΣϯτ
    ޱ࠲৘ใΛొ࿥͢Δ·Ͱ
    Ұ෦෼͚ͩػೳ࢖༻੍ݶΛ͢Δͷ͕ॲ
    ཧ͕ෳࡶʹͳΓେมͩͬͨ

    View Slide

  35. 3 5
    ಋೖͯ͠Έͯؾ͍ͮͨ͜ͱ
    ɾϢʔβͷ్தͰͷ཭୤͕ଟ͔ͬͨͷͰɺޙ͔Βޱ࠲ొ࿥ͯ͠ग़ۚਃ੥͢Δܗʹ
    ͢Ε͹ྑ͔ͬͨɻ
    ɾग़ۚਃ੥ͷ࣌͸Ϣʔβ΋Ϟνϕʔγϣϯ্͕͕ΔͷͰɺೖྗ͸ͯ͘͠Εͦ͏
    ΤʔδΣϯτ
    ʢࢠΞΧ΢ϯτʣ
    ग़ۚਃ੥
    ཧ૝ܗ
    اۀ
    ʢCustomerʣ
    Stripeܾࡁ
    ૹۚ
    ΤʔδΣϯτ
    ʢࢠΞΧ΢ϯτʣ
    ঺հྉΛTadoru
    ଆͰҰ࣌తʹड
    ͚औΔ

    View Slide

  36. 3 6
    ·ͱΊ
    ɾϓϥοτϑΥʔϜͰख਺ྉΛऔΔϏδωεϞσϧʹ޲͍͍ͯ
    Δ
    ɾϢʔβͷϞνϕʔγϣϯʹΑͬͯ͸ɺޱ࠲৘ใΛొ࿥ͤ͞Δ
    λΠϛϯά΍ಋઢ͸ؾΛ͚ͭͳ͍ͱϢʔβ͕ΞΫςΟϒʹͳΓ
    ʹ͍͘ɻ

    View Slide

  37. 3 7
    ࢀߟจݙ
    https://qiita.com/y_toku/items/7bfa42793801dfc5415d
    https://stripe.com/connect

    View Slide