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 x ReactNative でフリマアプリを作った話 - React Nativ...
Search
fxwx23
October 08, 2022
Programming
1
980
Stripe x ReactNative でフリマアプリを作った話 - React Native Matsuri 2022
fxwx23
October 08, 2022
Tweet
Share
More Decks by fxwx23
See All by fxwx23
マルチモジュールにおけるテスト最適化
fxwx23
0
210
Other Decks in Programming
See All in Programming
2024 컴포즈 정원사
jisungbin
0
150
僕が思い描くTypeScriptの未来を勝手に先取りする
yukukotani
9
2.4k
KSPの導入・移行を前向きに検討しよう!
shxun6934
PRO
0
220
RAGの回答精度評価用のQAデータセットを生成AIに作らせた話
kurahara
0
250
Amazon Neptuneで始める初めてのグラフDB ー グラフDBを使う意味を考える ー
satoshi256kbyte
2
260
Go1.23で入った errorsパッケージの小さなアプデ
kuro_kurorrr
2
390
いまから追い上げる、Jetpack Compose トレーニング
nyafunta9858
0
530
How to Break into Reading Open Source
kaspth
2
210
AndroidアプリのUIバリエーションをあの手この手で確認する / Check UI variations of Android apps by various means
tkmnzm
1
140
Kotlin 2.0 and Beyond
antonarhipov
2
150
労務ドメインを快適に開発する方法 / How to Comfortably Develop in the Labor Domain
yuki21
1
250
Using Livebook to build and deploy internal tools @ ElixirConf 2024
hugobarauna
0
250
Featured
See All Featured
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
109
6.9k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Clear Off the Table
cherdarchuk
91
320k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2k
How GitHub (no longer) Works
holman
310
140k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
157
15k
How to name files
jennybc
75
98k
How To Stay Up To Date on Web Technology
chriscoyier
786
250k
The Invisible Customer
myddelton
119
13k
What the flash - Photography Introduction
edds
67
11k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
Practical Orchestrator
shlominoach
185
10k
Transcript
@fxwx23 Stripe x React Native Ͱ ϑϦϚΞϓϦΛ࡞ͬͨ React Native Matsuri
2022 / 2022.10.08
ࣗݾհ ɾᬒ ࢙و (Fumitaka Watanabe) ɾגࣜձࣾNewelse ڞಉۀऀ݉SWE (2014~) ɾGitHub: @fxwx23
ɾTwitter: @fxwx23 ɾࣗࣾϓϩμΫτͷ։ൃશൠΛ୲ (Go, TypeScript)
https://unstreet.jp
UNSTREET AIؑఆ͖ͭεχʔΧʔϑϦϚΞϓϦ ɾεχʔΧʔಛԽͷϑϦϚػೳΛఏڙ։࢝ (20228݄~) ɾAIը૾ؑఆαʔϏεͱఏܞِ͠Λରࡦ ɾ20186݄ εχʔΧʔൃചใΞϓϦͱͯ͠ ϦϦʔε
ຊͷ͓ ɾͳͥ React Native ʹҠߦ͔ͨ͠ ɾSwiftωΠςΟϒΞϓϦ͔ΒͲ͏Ҡߦ͢Δ͔ ɾReact Native ͜Μͳײ͡Ͱͬͯ·͢ ɾϑϦϚʹ͓͚Δ
stripe-react-native ͷ׆༻
Why React Native ?
ϑϦϚҎલ ɾεχʔΧʔͳͲͷൃചใͳͲΛνΣο ΫͰ͖ΔϝσΟΞΞϓϦͱͯ͠ӡ༻͍ͯ͠ ͨ ɾiOSΞϓϦͷΈఏڙɺશSwift ɾUIKit + Interface Builder (Storyboard)
C2C Support
େ෯ͳUIͷมߋ͕ൃੜ ɾUIKit + Interface Builder ർΕͨ😂 ɾ΄΅৽نViewͰɺ࣮࣭ϑϧϦϓϨΠε ▪ Hot reload
ͳ͍ͷͰมߋͷ֬ೝʹBuildɺԹ͔Έͷ͋ΔखಈͷIBOutlet etc ▪ એݴతUI͕ओྲྀʹͳ͖͍ͬͯͯΔ & Interface Builder σΟείϯʹͳΔͷා͍ ɾAndroidग़͍ͨ͠
࣮ࡍʹҠߦલʹߦΘΕͨ GitHub Discussions
ͨΒ͞Εͨબࢶ ɾSwiftUI + UIKit ɾUIKit + Interface Builder ɾReact Native
ɾFlutter
SwiftUI + UIKit ɾকདྷੑ͋Δ͠ɺSwiftࣗମਪͤΔ ɾ৽نViewͷΈSwiftUIΛར༻͢Δݱ࣮࿏ઢ ɾಈ࡞ʹएׯෆ҆ʁ iOS14 ΛΕͳΜͱ͔ͳΔ͔ ɾֶशίετ͋ΓͰɺՌʹAndroidΞϓϦͳ͍…
Flutter ɾຊͰRNΑΓਓޱଟ͍ʁ࠾༻໘Ͱ͍͍ͷ͔ʁ ɾશͯDartʹ͢Δ͘Β͍ͷؾ࣋ͪͳΒΞϦ ɾ৽نϓϩδΣΫτͳΒ࠾༻ͯ͠ྑ͔ͬͨ
React Native ɾࣾͷࣗಈԽπʔϧʹ Firebase Functions/Node.jsɺTypeScript ɾReact (Next.js) ͍ͬͯͨ ɾReact HooksɺLinter
ͳͲͷݟ
React Native Λ࠾༻ ɾࣾͷࣗಈԽπʔϧʹ Firebase Functions/Node.jsɺTypeScript ɾReact (Next.js) ͍ͬͯͨ ɾReact
HooksɺLinter ͳͲͷݟ ɾपғͰ૬ஊͰ͖Δਓ͕͍ͨͷޙԡ͠
Swift → React Native
Ҡߦʹ͋ͨΓ ɾӨڹൣғ͕ͳ͍Android൛ΛઌߦͰϦϦʔε ɾطଘver͔Βͷमਖ਼ϦϦʔεͱฒߦ͢Δඞཁੑ ɾطଘϢʔβʔ͕Ξοϓσʔτͯ͠ࣄނΒͳ͍ etc
Ҡߦʹ͋ͨΓ ɾӨڹൣғ͕ͳ͍Android൛ΛઌߦͰϦϦʔε ɾطଘver͔Βͷमਖ਼ϦϦʔεͱฒߦ͢Δඞཁੑ ɾطଘϢʔβʔ͕Ξοϓσʔτͯ͠ࣄނΒͳ͍ etc
Ҡߦʹ͋ͨΓ ɾӨڹൣғ͕ͳ͍Android൛ΛઌߦͰϦϦʔε ɾطଘver͔Βͷमਖ਼ϦϦʔεͱฒߦ͢Δඞཁੑ ɾطଘϢʔβʔ͕Ξοϓσʔτͯ͠ࣄނΒͳ͍ etc
։ൃΛฒߦ͢Δ্Ͱ ɾBundle ID ΛطଘωΠςΟϒΞϓϦͱ͚ͯ։ൃΛελʔτ ɾωΠςΟϒଆʹमਖ਼͕ൃੜͯ͠ετϨεͳ͘ಈ͚Δ ɾωΠςΟϒଆ͕ίʔυϑϦʔζ͔ͯ͠Β Bundle ID Λಉ͡ͷʹ
Bundle ID: com.newelse.kix Bundle ID: com.newelse.kix Path: /var/abcdef…/KIX.app/ Path: /var/012345…/KIX.app/
ver 4.8.6 ver 5.0.0
Ҡߦςετ ɾطଘωΠςΟϒΞϓϦΛXcodeͰϏϧυͯ͠Πϯετʔϧ ɾͦͷޙʹ React Native ͷΞϓϦΛΠϯετʔϧͯ֬͠ೝ ɾωΠςΟϒΞϓϦͰอଘ͞ΕͨϩʔΧϧσʔλΛਖ਼͘͠ಡΈग़͢ ▪ NSUserDefaultsɺRealmɺSQLite
NSUserDefaults ɾϢʔβʔͷઃఆใ (Preferences) ΛӬଓతʹอଘ͢Δ͜ͱ͕త ɾΞϓϦΛআ͢Δͱ NSUserDefaults ফ͑Δ ɾNSData, NSString, NSNumber,
NSDate, NSArray, or NSDictionary ▪ ࢀর: https://developer.apple.com/documentation/foundation/nsuserdefaults
Settings https://reactnative.dev/docs/settings
AsyncStorage
AsyncStorage ɾAndroidͰಉ͡Λอ࣋͢ΔͨΊɺSettingsಡΈग़͠ݶఆ ɾอଘͰ͖Δͷશͯ string → typeof Ͱௐͯదʹม ɾNSDate, NSData
͖͋ΒΊΔ
NSDate, NSData null ѻ͍ ɾRCTJSONClean Ͱॲཧ͞ΕΔσʔλΫϥεݶΒΕΔ ▪ NSString, NSMutableString,
NSNumber, NSNull ͷΈ ▪ ࢀর: https://github.com/facebook/react-native/blob/main/React/Base/RCTUtils.m#L165 ɾNSUserDefaultsͷσʔλඞͣ RCTJSONClean Λ௨Δ
Realm JS ɾSwift SDK Ͱ࡞ͨ͠σʔλ ಡΈࠐΊΔ ▪ [ ] Ͱ
Realm.List<T> Λදݱ ▪ ࢀর: https://www.mongodb.com/docs/realm/sdk/react- native/examples/de fi ne-a-realm-object-model/ #supported-property-types ɾSchemaͰఆٛ ɾHermes Support ݱ࣌ͰRC
React Native Ͱͷߏ ɾExpo Modules ɾExpo Bare Work fl ow
ɾRecoil, Sentry, Realm, React Navigation (v6) ɾBase Component
React Native Ͱͷߏ ɾExpo Modules ɾExpo Bare Work fl ow
ɾRecoil, Sentry, Realm, React Navigation (v6) ɾBase Component
Done SwiftΞϓϦͷRepositoryͷݴޠߏ React NativeΞϓϦͷRepositoryͷݴޠߏ
Stripe https://stripe.com/jp
Stripe Connect ϓϥοτϑΥʔϜͱϚʔέοτϓϨΠεͷͨΊͷܾࡁΠϯϑϥ ɾച্ͷೖۚΛAPIͰཧ ɾ135 Ҏ্ͷ௨՟ͱ֤ࠃͷ͞·͟·ͳࢧ͍ํ๏ʹରԠ ɾސ٬֬ೝ (KYC) ʹରԠ https://stripe.com/jp/connect
@stripe/stripe-react-native ɾReactNative͚ͷStripe༻ܾࡁϥΠϒϥϦ ɾओʹܾࡁใͷऩूͱܾࡁͷ֬ఆΛ୲͍ɺͦͷͨΊͷUIͱը໘ཁૉΛఏڙ ɾstripe-android, stripe-ios Λར༻͢ΔͨΊͷϒϦοδ
Getting Started ɾinitStripe ͔ StripeProvider ͰॳظԽॲཧ ɾuseStripe ͢ΔલʹॳظԽ͓ͯ͘͠ඞཁ͕͋Δ ɾॳظԽ࣌ʹͤΔ Params
ಉ͡
None
ܾࡁใͷऩू ɾCardField Component ͔ Payment Element Λར༻
ܾࡁใͷऩू ɾCardField Component ͔ Payment Element Λར༻
Payment Element ҆શͰຒΊࠐΈՄೳͳ 1 ͭͷ UI ίϯϙʔωϯτ ɾೖྗϑΟʔϧυΛࣗಈతʹௐ͠ɺࢧ͍ํ๏ͱࠃʹج͍ͮͯใΛऩू ɾೖྗݕূɺϚεΩϯάɺελΠϧॲཧɺΤϥʔॲཧ ɾސ٬ͷΧʔυใΛཧ
Payment Element ҆શͰຒΊࠐΈՄೳͳ 1 ͭͷ UI ίϯϙʔωϯτ ɾೖྗϑΟʔϧυΛࣗಈతʹௐ͠ɺࢧ͍ํ๏ͱࠃʹج͍ͮͯใΛऩू ɾೖྗݕূɺϚεΩϯάɺελΠϧॲཧɺΤϥʔॲཧ ɾސ٬ͷΧʔυใΛཧ
None
None
None
None
None
None
None
ܾࡁॲཧͱ ࢥ͑ͳ͍΄Ͳ ؆ܿ
@stripe/stripe-react-native ɾγϯϓϧͳΠϯλʔϑΣΠεͰωΠςΟϒରԠͷUIΛར༻Ͱ͖Δ ɾ3DηΩϡΞʹ༰қʹରԠՄೳ ɾޱ࠲ใͷొʹରԠ (createToken)
@stripe/stripe-react-native ɾγϯϓϧͳΠϯλʔϑΣΠεͰωΠςΟϒରԠͷUIΛར༻Ͱ͖Δ ɾ3DηΩϡΞʹ༰қʹରԠՄೳ ɾޱ࠲ใͷొʹରԠ (createToken) https://stripe.com/docs/payments/accept-a-payment?platform=react-native
React Native ʹҠߦͯ͠Έͯ ɾ։ൃ͕֨ஈʹ্͕ͬͨ ▪ ಉ࣌ʹAndroid (or iOS) ͕Ͱ͖͕͋ΔͷΫϩεϓϥοτϑΥʔϜͷޣຯ ɾTypeScript,
React ͷݟԠ༻ͷαΠΫϧ͕ճΔ ɾWebϑϩϯτΤϯυͱͷ༥߹ ▪ React GUI, Expo Router etc ɾΫϥΠΞϯταΠυͷ૯߹֨ಆٕ
We are hiring!
We are hiring!
ࣗݾհ ɾᬒ ࢙و (Fumitaka Watanabe) ɾגࣜձࣾNewelse ڞಉۀऀ݉SWE (2014~) ɾGitHub: @fxwx23
ɾTwitter: @fxwx23 ɾࣗࣾϓϩμΫτͷ։ൃશൠΛ୲ (Go, TypeScript)
Thanks