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
Stripeでよかった
Search
nof
December 15, 2018
Technology
0
140
Stripeでよかった
JP_Stripes (Stripe ユーザーグループ)in 岡山 キックオフ
WebPayから乗り換えた話・仮売上の例
nof
December 15, 2018
Tweet
Share
More Decks by nof
See All by nof
オープンセミナー2020@広島 発表資料
nof
1
1k
Rails使いのNuxt.js入門 - 銀座Rails#12
nof
1
2k
Other Decks in Technology
See All in Technology
プロダクト価値を引き上げる、「課題の再定義」という習慣
moeka__c
0
160
srekaigi2025-hajimete-ippo-aws
masakichieng
0
130
Asset Centric な データ変換パイプラインの攻略法
recruitengineers
PRO
1
100
re:Invent Recap (January 2025)
scalefactory
0
320
2025-01-24-SRETT11-OpenTofuについてそろそろ調べてみるか
masasuzu
0
130
RevOpsへ至る道 データ活用による事業革新への挑戦 / path-to-revops
pei0804
1
460
TSのコードをRustで書き直した話
askua
4
980
HCP Terraformで実現するPlatform Engineering/nikkei-tech-talk-29
nikkei_engineer_recruiting
0
200
Plants vs thieves: Automated Tests in the World of Web Security
leichteckig
0
140
横断SREの立ち上げと、AWSセキュリティへの取り組みの軌跡
rvirus0817
3
3.6k
プロダクト開発、インフラ、コーポレート、そしてAIとの共通言語としての Terraform / Terraform as a Common Language for Product Development, Infrastructure, Corporate Engineering, and AI
yuyatakeyama
6
1.4k
実践!生成AIのビジネス活用 / How to utilize Generative AI in your own business
gakumura
1
190
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
590
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
Agile that works and the tools we love
rasmusluckow
328
21k
Speed Design
sergeychernyshev
25
750
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
20
2.4k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
A Modern Web Designer's Workflow
chriscoyier
693
190k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
Automating Front-end Workflow
addyosmani
1367
200k
Gamification - CAS2011
davidbonilla
80
5.1k
Code Reviewing Like a Champion
maltzj
521
39k
Transcript
StripeͰΑ͔ͬͨ ࣮ྫΛަ͑ͯྑ͔ͬͨ͜ͱΛհ SonicGarden ࡔխढ़
୭Ͱ͔͢ • ౡ͔Βདྷ·ͨ͠ • ࡔխढ़ ʮ͔͞ʯ ͱݺΕ͍ͯ·͢ • Ԭࢁͷษڧձʹͨ·ʹདྷ·͢ •
גࣜձࣾιχοΫΨʔσϯ ϓϩάϥϚ • Rails͍ͬͯ·͢
͢͜ͱ • Webpay ͔Β Γ͑ͨ • Ծച্ͷྫ • ࠓͷʹͰͨ Stripe
API
WebPay͔ΒΓ͑ͨ
WebPayαʔϏεऴྃ (Stripeͱͷग़ձ͍) • 2016/10/31 Ξφϯε • 2017/04/30 ՝ۚػೳఀࢭ • ͞Εͨ࣌ؒ
6ϲ݄ WebPayͰ՝ۚॲཧΛ࣮͍ͯ͠Δ αʔϏε͕͋ͬͨͷͰҠߦ͕ඞཁ
Ҡߦઌͷબఆɿ Stripe ʹܾΊͨཧ༝ • ࠓճҠߦ͕ඞཁʹͳͬͨαʔϏεͰ͍ͬͯͨ͜ͱ • ձඅɿఆظ՝ۚ • دۚɿ՝ۚ •
ޓੑ͕ߴ͍ • Charge, Customer جຊతͳΦϒδΣΫτͲ͏ΒҰॹͷߏ • Χʔυձࣾͷ࠶৹ࠪෆཁ • ళࢠػೳ (Stripe Connect) ʹڵຯ
ͬͨ͜ͱ • ϓϩάϥϜमਖ਼ • ςετ • CustomerσʔλҠɾఆظ՝ۚҾ͖ܧ͗ • WebPayΞΧϯτ͕Ұ্ͭͩͬͨؔɺҠͷࡍʹ͓٬͞ΜΛ ަ͑ͨΩϟονϘʔϧΛ
• Ҡ࡞ۀͪ 10/31 12݄ 1݄ 3݄ WebPayऴྃΞφϯε બఆ मਖ਼ ςετ 2݄ 3݄ Stripe՝ۚରԠϦϦʔε CustomerσʔλҠߦ ఆظ՝ۚҾ͖ܧ͗
ϓϩάϥϜमਖ਼ (৽نͷ՝ۚॲཧΛStripeʹ͚Δ) • charge_key ɺܾࡁΛҰҙʹ͢ΔΩʔΛσʔλϕʔεʹΧϥϜՃ • WebPay API ͍ͬͯΔͱ͜ΖΛ Stripe
API ͏Α͏ʹΤϯυϙΠ ϯτมߋ • WebHook ॲཧՃ ఆظ՝ۚ༻ʹStripeͱWebPayΛಉ࣌ར༻ • Stripeಛ༗ͷॲཧՃ ఆظ՝ۚ༻ʹPlanͱ͍͏֓೦ొ
ςετ • stripe-ruby-mock gem • mockαʔόʔͰͳ͘ɺstripe-ruby ͷAPIίʔϧ෦Λmock
σʔλҠ • ᶃ WebPay - Stripe ސ٬ใɾΧʔυใҠ • WebPay -
Stripe ؒͰސ٬ใҠ (PCI DSS४ڌ͍ͯ͠ΔͨΊՄೳ) • StripeଆͰ৽͘͠࡞ΒΕͨCustomerใΛJSONͰఏڙ͍͖ͨͩɺγεςϜͷUserใͱඥ͚ • ᶄ ఆظ՝ۚ༻σʔλ࡞ • Plan ࡞ • WebPayͷRecursionΛఀࢭɺ৽͘͠StripeଆʹSubscriptionΛ࡞Δ (trial_end ʹ͍Εͯɺ͔ͦ͜Β։ ࢝)
ײ • Stripe αϙʔτ͞Μʹ૬ஊ͠ͳ͕Β࣮ࢪͰ͖ͨ • ಙӬ͞ΜʹΑΖ͓͑͘͠Լ͍͞ • σʔλߏ΄΅ಉͩͬͨ͡ͷͰɺॿ͔ͬͨ • WebPayΞΧϯτ͕ҰͭͳͷͰɺҠͷࡍʹ͓٬͞ΜΛަ͑ͨ
ΩϟονϘʔϧΛΔ͜ͱʹɻStripeෳΞΧϯτΛඥ͚ΒΕ ΔͷͰྑ͍ • StripeͰΑ͔ͬͨ
Ծച্ͷྫ
Ծച্ • ·ܾͩࡁ͠ͳ͍͚Ͳ༩৴͚ͩ֬อ • ͋ͱ͔ΒܾࡁͰ͖Δ • τϨʔχϯάͷ༧γεςϜͰ͍·ͨ͠
• capture: false Ͱ Charge ͢Δ͚ͩ • ޙɺCharge.capture Ͱܾࡁྃ
ߟྀ࿙Ε • ༩৴ͷ֬อظݶ7ؒ • 7ؒΑΓઌͷ༧Λͱͬͯ͠·ͬͨ • τϨʔχϯάʹΤϥʔɻܾࡁͰ͖ͳ͍ • ྉۚΛ͔͘ɺޙৼࠐΈ͔ɻɻɻ •
େৎͩͬͨʂ • Stripe͔ͬͯͨΒେৎͩͬͨʂ
͔Β͘Γ • Stripe Ͱސ٬ใΛཧͯ͘͠ΕΔ Customer Λ࡞͍ͬͯͨ • Customer ʹΫϨδοτΧʔυใؚ·ΕΔ •
৽͘͠ Charge Λ࡞ܾͬͯࡁޭ • StripeͰΑ͔ͬͨ • ॿ͔ͬͨͱಉ࣌ʹɺCustomerใݫॏʹѻΘͶͱ࠶ೝࣝ • ͖ͳ͚ܾͩࡁͰ͖ͪΌ͏ʁ
ࠓͷʹग़ͨ Stripe API
Customer (͓٬͞Μ) • ՝ۚͰ͋Ε࡞Βͳͯ͘ྑ͍͚Ͳɺ࡞ͬͯ͋Δͱ Customer Λ࣠ʹ ߦಈΛัଊͰ͖ͯศར • γεςϜͷϢʔβʔͱඥ͚·͢ •
ΫϨδοτΧʔυͷใͱඥ͍͍ͯ·͢
Charge (ܾࡁ) • ྉۚΛઃఆͯ͠create͢Ε՝ۚͰ͖·͢ • Customerͱඥ͚Մೳ • ࡞Δͱ͖ʹ࣮ച্ɺԾച্Λ੍ޚͰ͖·͢ (capture =
true/false)
Refund (ฦۚ) • ฦۚ͠·͢ • Ծച্ʹͨ͠ChargeͷऔΓফ͜͠ͷAPIͰΓ·͢
Plan (ఆظ՝ۚͷϓϥϯ) • ఆظ՝ۚͷϧʔϧͰ͢ • ྉۚɺΠϯλʔόϧ(ɺिɺ݄ɺ)ΛܾΊ·͢
Subscription (ఆظॲཧ) • Customer͝ͱͷఆظॲཧϧʔϧ • PlanʹैͬͯChargeΛ࡞ͬͯ͘Ε·͢ • ։࢝ɾऴྃΛઃఆͨ͠Γ • τϥΠΞϧظؒޙɺఆظॲཧ։࢝
Έ͍ͨͳ͜ͱͰ͖·͢
ଞʹ • ֤ΦϒδΣΫτʹmetadataΛೖΕ͓͚ͯɺμογϡϘʔυͰݕࡧ Ͱ͖ͨΓ • ΤϯδχΞ͚ʹΘ͔Γ͍͢υΩϡϝϯταϯϓϧ • ૉΒ͍͠ Stripe ίϛϡχςΟ
• StripeͰΑ͔ͬͨ
͓ΘΓ