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
GraphQL for a Payments API
Search
Sadique Ali
November 09, 2018
Programming
2
400
GraphQL for a Payments API
Sadique Ali
November 09, 2018
Tweet
Share
Other Decks in Programming
See All in Programming
CSC307 Lecture 08
javiergs
PRO
0
330
Polarsの成長: v0.14からv1.0までの変遷と今後の展望
zerebom
1
350
APIのない大学ログインWebサービスをWKWebViewとJavaScriptでアプリ化した話
akidon0000
1
330
しくじり先生 Image Matching Challenge 2024 編
goosehaaan
0
810
CSC307 Lecture 10
javiergs
PRO
0
310
Trial
cairolibrary720
1
130
入社1ヶ月でここまでやった!Findy Toolsインフラ支援の最適化
rvirus0817
6
1.4k
CSC307 Lecture 05
javiergs
PRO
0
210
継続的な活動で築く地方エンジニアの道
myamashii
2
360
3 Effective Rules for Success with Signals in Angular
manfredsteyer
PRO
0
120
ドメイン駆動設計の実践
masuda220
PRO
19
5.2k
生成AIをkintoneに連携してみた
hideg
0
230
Featured
See All Featured
Become a Pro
speakerdeck
PRO
15
4.8k
Fantastic passwords and where to find them - at NoRuKo
philnash
42
2.7k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
16
1.6k
Docker and Python
trallard
37
2.9k
Into the Great Unknown - MozCon
thekraken
20
1.3k
No one is an island. Learnings from fostering a developers community.
thoeni
17
2.8k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
34
1.9k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
78
15k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
662
120k
WebSockets: Embracing the real-time Web
robhawkes
59
7.2k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
20
7.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
129
32k
Transcript
GraphQL for a Payments API Challenges and Lessons Sadique Ali
Koothumadan @sdqali
None
GraphQL at Braintree is part of our ongoing platform’s digital
transformation, which allows us to deliver an always improving developer and online consumer experience.
https://graphql.braintreepayments.com
SDK ❤
Card API REST + JSON REST + XML GRPC Tokenize
Tokenize Tokenize ACH ACH ACH Card Card ☁ ☁ ☁ ☁ ☁ ☁ JS SDK Python SDK Ruby SDK Java SDK Go SDK
No Absolutisms
Why GraphQL?
• Consumers of our API are tech-savvy • Direct Integrations
• Added benefits for SDKs
• “Choose your payload” • Mobile friendly • Faster integration
• Interactive tooling • Evolvability
Technology Choices
“GraphQL exists because JavaScript people love JSON too much”
ReportEdgeResolverFactory ?
ReportEdgeResolverFactory
• graphql-java • java-dataloader • graphql-java-tools
Schema files
• cards • tokenize • report • merchant Along domain
boundary?
util and common are where things go to die.
• inputs • types • queries • mutations • ...
Along GraphQL concepts?
To Relay or Not?
• Consistent input structure • Connections and pagination • IDs
and Refetching Relay goodies
Global IDs
• /transactions/wv3e1js/close • /merchants/tw763ex IDs in the REST world
• Format • Backwards compatibility Global IDs
• Opaque url-safe Base64 encoded strings • Attach global_ids to
legacy responses Global IDs
• Certain entities won’t have Global IDs Global IDs
Query Complexity
• Assign complexity factor to entities • Instrumentation to enforce
limit Max Complexity
API Visibility
• Server side consumers • Client side consumers • Admin
panel • ... Control what consumer can see what
• Detect consumer • Reject if invisible Visibility Instrumentation
Authorization
@NeedToBe(ADMIN) /admin-endpoint adminEndpoint() { // ... } REST
type Query { panelData: PanelData } type PanelData { transactions:
[Transaction], # Merchant portal failures: [Transaction] # Admin panel } GraphQL
Design for Partial Success
Card GraphQL API REST + JSON REST + XML GRPC
Tokenize Tokenize Tokenize ACH ACH ACH Card Card ☁ ☁ ☁ ☁ ☁ ☁
Card GraphQL API REST + JSON REST + XML GRPC
Tokenize Tokenize Tokenize ACH ACH ACH Card Card ☁ ☁ ☁ ☁ ☁ ☁
Card GraphQL API REST + JSON REST + XML GRPC
Tokenize Tokenize Tokenize ACH ACH ACH Card Card ☁ ☁ ☁ ☁ ☁ ☁
Card GraphQL API REST + JSON REST + XML GRPC
Tokenize Tokenize Tokenize ACH ACH ACH Card Card ☁ ☁ ☁ ☁ ☁ ☁
• Be comfortable serving nulls • Collect all the errors
Partial successes
Error handling
{ error : { “user_message”: “...”, “developer_message”: “...”, “details”: [{
“code”: “...”, “in”: “header”, “at”: “authorization” }] } } REST
• Represent multiple errors • Support legacy error codes
{ errors : [{ message: "No report exists because there
are no transactions on that date.", locations: [{ line: 3, column: 5, }], path: [ "report", "transactions", ], extensions: { errorType: "user_error", errorClass: "NOT_FOUND", } }] }
None
Team workflow
• Multiple products contributing to the schema • Custodians of
the schema need to play a balancing act
• Collaboration • Always propose schema changes first
Focus on the Schema
Thank You :D