Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
470
GraphQL for a Payments API
Sadique Ali
November 09, 2018
Tweet
Share
Other Decks in Programming
See All in Programming
Developing static sites with Ruby
okuramasafumi
0
260
tparseでgo testの出力を見やすくする
utgwkk
1
190
Microservices rules: What good looks like
cer
PRO
0
1.2k
Microservices Platforms: When Team Topologies Meets Microservices Patterns
cer
PRO
1
1k
FluorTracer / RayTracingCamp11
kugimasa
0
220
ZOZOにおけるAI活用の現在 ~モバイルアプリ開発でのAI活用状況と事例~
zozotech
PRO
8
5.5k
生成AIを利用するだけでなく、投資できる組織へ
pospome
1
270
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
310
認証・認可の基本を学ぼう前編
kouyuume
0
190
ソフトウェア設計の課題・原則・実践技法
masuda220
PRO
26
22k
「コードは上から下へ読むのが一番」と思った時に、思い出してほしい話
panda728
PRO
38
25k
Go コードベースの構成と AI コンテキスト定義
andpad
0
120
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
970
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Navigating Team Friction
lara
191
16k
Typedesign – Prime Four
hannesfritz
42
2.9k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Facilitating Awesome Meetings
lara
57
6.7k
How GitHub (no longer) Works
holman
316
140k
Thoughts on Productivity
jonyablonski
73
5k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.8k
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