Save 37% off PRO during our Black Friday Sale! »

Stripe CLIを触ってみた!

Ca1357a6e793898d30cec23068c3cb36?s=47 大塚真言
December 18, 2019

Stripe CLIを触ってみた!

Ca1357a6e793898d30cec23068c3cb36?s=128

大塚真言

December 18, 2019
Tweet

Transcript

  1. Stripe CLIΛ৮ͬͯΈͨʂ 2019/12/18 JP_Stripesٶ࡚ Vol.4 େ௩ਅݴ

  2. ൃදΛฉ͍ͯཉ͍͠ํ • Stripe CLI ͕ؾʹͳ͍ͬͯΔ • CLIͬͯԿʁ • WebhookͬͯԿʁ

  3. ࣗݾ঺հ -BSBWFM 7VFKT 'JSFCBTF α΢φେ޷͖ͳ8FCΤϯδχΞ"

  4. α΢φେ޷͖ α΢φ׆ಈि೔ ςϯτα΢φߪೖܭըத

  5. ձࣾ঺հʢ֓ཁʣ ߹ಉձࣾϊϚυϦ ૑ۀظ໨ ϝϯόʔ໊ 8FCܥडୗ։ൃ ϑϧϦϞʔτ

  6. ձࣾ঺հʢ࢓ࣄʣ • Vue.jsͷಋೖࢧԉɾઃܭ࣮૷ϨϏϡʔ • ҩྍܥWebαʔϏεͷUI/UXվળʢLaravelʣ • ҩྍܥΞϓϦͷ৽نडୗ։ൃʢCordova+Vue.js+Firebaseʣ • JAMstackϕʔεͷ੩తαΠτߏங ʢNuxt.js+Netlify+contentfulʣ

  7. ίϛϡχςΟӡӦ • JP_Stripesٶ࡚ • ͯ͛΄͛ʢٶ࡚WebܥϑϦʔϥϯεूஂʣ
 ※1݄31೔ʹ WebφΠτٶ࡚ ։࠵͠·͢ʂ • JBUGٶ࡚

  8. Stripe CLI ͱ͸

  9. Stripe CLI ͱ͸ • 2019೥11݄ϦϦʔε͞Εͨ৽ػೳ • StripeͷػೳΛϓϩάϥϜ͔ΒͰ͸ͳ͘ɺ
 λʔϛφϧ͔Βݺͼग़͢͜ͱ͕Ͱ͖Δ

  10. DIBSHFa4USJQFa$IBSHFDSFBUF < bBNPVOU`  bDVSSFODZ`bKQZ`  bTPVSDF`bUPL@WJTB`  > 

    ϓϩάϥϜʢPHPʣ TUSJQFDIBSHFTDSFBUFa BNPVOUa DVSSFODZKQZa TPVSDFUPL@WJTB λʔϛφϧʢίϚϯυʣ
  11. ಛ௃

  12. ಛ௃ • cURLΑΓѹ౗తʹϢʔβϑϨϯυϦʔ • αʔυύʔςΟͷτϯωϦϯάιϑτ΢ΣΞ ʹґଘͤͣWebhookͷςετ͕Մೳ

  13. ಛ௃ • cURLΑΓѹ౗తʹϢʔβϑϨϯυϦʔ • αʔυύʔςΟͷτϯωϦϯάιϑτ΢ΣΞ ʹґଘͤͣWebhookͷςετ͕Մೳ

  14. DVSMIUUQTBQJTUSJQFDPNWDIBSHFTa V"1*γʔΫϨοτΩʔa EBNPVOUa EDVSSFODZKQZa ETPVSDFUPL@WJTBa cURL Stripe CLI TUSJQFDIBSHFTDSFBUFa BNPVOUa

    DVSSFODZKQZa TPVSDFUPL@WJTB
  15. help͕ॆ࣮

  16. Demo

  17. ಛ௃ • cURLΑΓѹ౗తʹϢʔβϑϨϯυϦʔ • αʔυύʔςΟͷτϯωϦϯάιϑτ΢ΣΞ ʹґଘͤͣWebhookͷςετ͕Մೳ

  18. Webhookͱ͸ • ΞϓϦέʔγϣϯͷߋ৽৘ใΛଞͷΞϓϦ έʔγϣϯ΁ϦΞϧλΠϜఏڙ͢Δ࢓૊Έ΍֓ ೦ͷ͜ͱɻ • Πϕϯτൃੜ࣌ɺࢦఆͨ͠URLʹPOSTϦΫ Τετ͢Δ࢓૊Έͷ͜ͱɻ

  19. Webhookͱ͸ • ΞϓϦέʔγϣϯͷߋ৽৘ใΛଞͷΞϓϦ έʔγϣϯ΁ϦΞϧλΠϜఏڙ͢Δ࢓૊Έ΍֓ ೦ͷ͜ͱɻ • Πϕϯτൃੜ࣌ɺࢦఆͨ͠URLʹPOSTϦΫ Τετ͢Δ࢓૊Έͷ͜ͱɻ 4USJQF ࣗ਎ͷΞϓϦ

    FY4USJQFͷ৹͕ࠪ௨ͬͨͱ͖ ࣗ਎ͷΞϓϦ
  20. ᶃ4USJQF৹ࠪ ͕௨ͬͨͱ͖ ᶄWebhook௨஌ https://hoge.com/hooks ᶅԿ͔͠Βͷॲཧ Ϣʔβͷεςʔλεߋ৽

  21. ϩʔΧϧ؀ڥͰͷ ςετ͕೉͍͠

  22. ᶃ4USJQF৹ࠪ ͕௨ͬͨͱ͖ ᶄWebhook௨஌ https://hoge.com/hooks ᶅԿ͔͠Βͷॲཧ Ϣʔβͷεςʔλεߋ৽ ᶃ4USJQF৹ࠪ ͕௨ͬͨͱ͖ ᶄWebhook௨஌ http://localhost/hooks

    ᶅԿ͔͠Βͷॲཧ Ϣʔβͷεςʔλεߋ৽ ϩʔΧϧ؀ڥ ໊લղܾͰ͖ͣ 8FCIPPL௨஌͕ಧ͔ͳ͍ ຊ൪؀ڥ
  23. ᶃ4USJQF৹ࠪ ͕௨ͬͨͱ͖ ᶄWebhook௨஌ http://localhost/hooks ᶆԿ͔͠Βͷॲཧ Ϣʔβͷεςʔλεߋ৽ ϩʔΧϧ؀ڥ τϯωϦϯάιϑτ΢ΣΞ ʢngrokʣ ᶄWebhook௨஌

    http://4dh94josjtt/hooks ᶅWebhookసૹ http://localhost/hooks ×
  24. ᶃ4USJQF৹ࠪ ͕௨ͬͨͱ͖ ᶄWebhook௨஌ http://localhost/hooks ᶆԿ͔͠Βͷॲཧ Ϣʔβͷεςʔλεߋ৽ ϩʔΧϧ؀ڥ Stripe CLI $

    stripe listen --forward-to localhost:5000/hooks × ᶄWebhook௨஌ ᶅWebhookసૹ
  25. ·ͱΊ

  26. ·ͱΊ • cURLΑΓѹ౗తʹϢʔβϑϨϯυϦʔ • αʔυύʔςΟͷτϯωϦϯάιϑτ΢ΣΞ ʹґଘͤͣWebhookͷςετ͕Մೳ • DockerΠϝʔδͰͷCLI؀ڥߏங΋ՄೳͳͷͰ CI/CDͱͷ࿈ܞ΋Մೳ͔΋

  27. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ