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
420
GraphQL for a Payments API
Sadique Ali
November 09, 2018
Tweet
Share
Other Decks in Programming
See All in Programming
Zoneless Testing
rainerhahnekamp
0
130
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
310
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
410
Online-Dokumentation, die hilft: Strukturen, Prozesse, Tools
ahus1
0
100
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
180
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
340
CloudflareStack でRAGに入門
asahiiwm
0
130
AppRouterを用いた大規模サービス開発におけるディレクトリ構成の変遷と問題点
eiganken
1
200
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
250
Запуск 1С:УХ в крупном энтерпрайзе: мечта и реальность ПМа
lamodatech
0
780
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
110
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
120
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
521
39k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
How STYLIGHT went responsive
nonsquared
96
5.2k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Done Done
chrislema
182
16k
How to train your dragon (web standard)
notwaldorf
88
5.8k
A designer walks into a library…
pauljervisheath
205
24k
Adopting Sorbet at Scale
ufuk
74
9.1k
Speed Design
sergeychernyshev
25
690
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
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