Webhook だけで Stripe を使ってみた(が、失敗だった)

Webhook だけで Stripe を使ってみた(が、失敗だった)

2020/02/22 の #JP_Stripes で使ったスライドです。Stripe はいいぞ!

Eccc8d18a1e2cb0a63fba88e36e7c880?s=128

teramotodaiki

February 22, 2020
Tweet

Transcript

  1. 8FCIPPL͚ͩͰ 4USJQFΛ࢖ͬͯΈͨ !UFSBNPUPEBJLJ

  2. 8FCIPPL͚ͩͰ 4USJQFΛ࢖ͬͯΈͨ !UFSBNPUPEBJLJ ͕ɺࣦഊͩͬͨ

  3. ϓϩάϥϛϯάͷָ͠͞Λ ࢠڙͨͪʹ఻͑Δ࢓ࣄ ࣉຊେً ϋοΫϑΥʔϓϨΠגࣜձࣾɹ୅දऔక໾ ࠽ ࢠڙͨͪʹϓϩάϥϛϯάΛ޷͖ʹͳͬͯཉͯ͘͠ɺ ϋοΫͯ͠ΫϦΞ͢ΔήʔϜ)BDLGPS1MBZΛ։ൃ ىۀɻ ಉίϯςϯπΛ༻͍ͨڭҭΛଟํ໘Ͱ࣮ફ͍ͯ͠Δ $PEFS%PKP,BOB[BXB

    8IPBN*
  4. https://www.youtube.com/watch?v=yxISRs1YG9w

  5. ϋοΫϑΥʔϓϨΠʹ͋Δ ήʔϜ͸શͯࣗ෼Ͱ૑ΕΔ ͢΂ ͡ Ϳ Μ    ༡ΜͰ͍Δͱɺ૑Γͨ͘ͳΔ

    ͋ͦ ͭ͘ ͔ͩΒɺ ͕ͬͪ͜ຊ໋
  6. IUUQTXXXZPVUVCFDPNXBUDI WR:"+H06

  7. 8FC*%& Ϣʔβʔͷίʔυ ࠷৽ͷ&$."4DSJQU 4BOECPYFEJGSBNF ౤ߘαΠτ ήʔϜϥΠϒϥϦ ΩϟϥΫλʔૉࡐ ϚοϓΤσΟλ ϨΨγʔϒϥ΢βͰ ͏͘͝+BWB4DSJQU

    ($4ͷ$%/ ಈతͳґଘղܾ 8FC.FTTBHJOH"1* ϋοΫϑΥʔϓϨΠ͸Ͳ͏΍ͬͯಈ͍͍ͯΔͷ͔
  8. Ϣʔβʔͷϓϥϯʹ ΑͬͯॲཧΛม͍͑ͨ օ͞ΜͳΒͲ͏͠·͔͢ʁ ຊ୊

  9. ϢʔβʔͷϓϥϯʹΑͬͯॲཧΛม͍͑ͨ 4USJQFͷ$VTUPNFS ʹඥ͚ͮΒΕ͍ͯΔ 4VCTDSJQUJPOͷঢ়ଶ ʢແྉձһc༗ྉձһʣ ΫϥΠΞϯταΠυͰ ಈతʹ%0.Λมߋ͢Δ ྫʣϓϨϛΞϜϢʔβʔͳΒ ̍೔̍̌ճϘλϯΛԡͤΔ ͱΓ·υΩϡϝϯτಡΉ͔ʜ

    4USJQF͔Βސ٬৘ใΛऔಘ͢Δํ๏͑͞෼͔Ε͹؆୯ͦ͏ʁ
  10. ˢΊͬͪΌػೳଟ͍

  11. ࠓճ࢖͍͍ͨػೳɿ#JMMJOH

  12. /PEFKTʢαʔόʔαΠυʣͷαϯϓϧ TL@͔Β࢝·Δͷ͸γʔΫϨοτΩʔ ސ٬৘ใͷऔಘʹ͸γʔΫϨοτΩʔ͕ඞཁ ͳͷͰɺαʔόʔαΠυ͔Βߦ͏ඞཁ͕͋Δ SFUSJFWFʹऔಘ"1*

  13. $MPVE'VODUJPO BQJHFU$VTUPNFS 0"VUI5PLFO c ͭ·Γ͜͏͍͏͜ͱˣ DVTUPNFSTSFUSJFWF  4FDSFU,FZ $VTUPNFSPCKFDU ސ٬৘ใ͕มߋ͞ΕͨΒ

    ࠶౓औಘ͢Δඞཁ͕͋Δ
  14. ސ٬৘ใ͕มߋ͞ΕͨΒ ࠶౓औಘ͢Δඞཁ͕͋Δ $MPVE'VODUJPO BQJHFU$VTUPNFS 0"VUI5PLFO c ͭ·Γ͜͏͍͏͜ͱˣ DVTUPNFSTSFUSJFWF  4FDSFU,FZ

    $VTUPNFSPCKFDU ΋͠ސ٬৘ใ͕ ԿΒ͔ͷཧ༝Ͱ มߋ͞ΕͨΒʜ
  15. ϒϥ΢βϦϩʔυͰྑ͘Ͷʁ 41"͸ސ٬͕Ϧϩʔυ͠ͳ͖Ό ͍͚ͳ͍ঢ়ଶΛ࡞ͬͨΒෛ͚

  16. $MPVE'JSFTUPSF 'JSFTUPSF্ͷσʔλͷมߋΛ؆୯ʹ4VCTDSJCFͰ͖Δʂ

  17. $MPVE'JSFTUPSF SFGPO4OBQTIPU  0"VUI5PLFO DVTUPNFSTSFUSJFWF  4FDSFU,FZ $VTUPNFSPCKFDU $VTUPNFSPCKFDU ͭ·Γ͜͏͍͏͜ͱˣ

    ʜ
  18. $MPVE'JSFTUPSF SFGPO4OBQTIPU  0"VUI5PLFO DVTUPNFSTSFUSJFWF  4FDSFU,FZ $VTUPNFSPCKFDU $VTUPNFSPCKFDU ͭ·Γ͜͏͍͏͜ͱˣ

    ʜ ސ٬৘ใͷมߋ͸୭͕ ڭ͑ͯ͘ΕΔͷʜʁ
  19. $MPVE'JSFTUPSF SFGPO4OBQTIPU  0"VUI5PLFO DVTUPNFSTSFUSJFWF  4FDSFU,FZ $VTUPNFSPCKFDU $VTUPNFSPCKFDU ͭ·Γ͜͏͍͏͜ͱˣ

    ʜ ސ٬৘ใͷมߋ͸୭͕ ڭ͑ͯ͘ΕΔͷʜʁ 'JSFTUPSFͷঢ়ଶ͕ ৗʹ࠷৽Ͱͳ͚Ε͹ શ͘ҙຯ͕ͳ͍ʜʂ
  20. զΒ͕4USJQFʹ͸ 8FCIPPL͕͋Δ 8FCIPPL

  21. $MPVE'JSFTUPSF SFGPO4OBQTIPU  0"VUI5PLFO $VTUPNFSPCKFDU c ͭ·Γ͜͏͍͏͜ͱˣ ʜ $MPVE'VODUJPO XFCIPPLFOEQPJOU

    ⚡ ⚡ ⚡
  22. ͜ΕͰ׬ᘳ

  23. ͜ΕͰ׬ᘳ Ͱ͸ͳ͔ͬͨ

  24. ͋Δ೔͓٬༷͔Βϝʔϧ͕ಧ͘✉ ϓϥϯΛมߋͨ͠ͷʹɺ ͍ͭ·Ͱܦͬͯ΋ಡΈࠐΈ͕ऴΘΒͳ͍ Ϧϩʔυͯ͠΋ϓϥϯ͕มΘ͍ͬͯͳ͍ αʔόʔͷϩάΛ֬ೝ͢Δ΋ɺΤϥʔ͸ͳ͠ ϝʔϧΛ֬ೝͨ࣌͠఺ͰϓϥϯΛ֬ೝ͢Δͱ ਖ਼ৗʹϓϥϯ͕มߋ͞Ε͍ͯͨ

  25. ࣗ෼ͷΞΧ΢ϯτͰࢼͯ͠ΈΔͱʜ ̍෼Ҏ্͔͔͍ͬͯͨ ߋ৽͔ͯ͠Β8FCIPPL͕ඈͿ·Ͱʹ 8FCIPPL͸ߋ৽͕εϜʔζʹײ͡ΒΕΔ΄Ͳૣ͘ͳ͍

  26. $MPVE'VODUJPO BQJHFU$VTUPNFS 0"VUI5PLFO DVTUPNFSTSFUSJFWF  4FDSFU,FZ $MPVE'JSFTUPSF SFGPO4OBQTIPU  0"VUI5PLFO

    ʜ $MPVE'VODUJPO ސ٬৘ใશମ ˠQPMMJOH ϓϥϯͷঢ়ଶ ˠTVCTDSJCF ര଎ ͦͦ͜͜ૣ͍ DVTUPNFSTSFUSJFWF  4FDSFU,FZ
  27. ·ͱΊ w 4USJQF͸SFUSJFWF"1*͕ΊͪΌͪ͘Όૣ͍ͷͰɺ ސ٬৘ใ͕มߋ͞Εͨ৔߹͸ଈ࠲ʹSFUSJFWF͢΂͖ w 8FCIPPL͸ศར͚ͩͲɺϓϥΠϚϦͳ৘ใ఻ୡखஈͰ ͸ͳ͍