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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Sadique Ali
November 09, 2018
Programming
2
480
GraphQL for a Payments API
Sadique Ali
November 09, 2018
Tweet
Share
Other Decks in Programming
See All in Programming
AI巻き込み型コードレビューのススメ
nealle
1
200
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
7
2.3k
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
200
CSC307 Lecture 07
javiergs
PRO
0
550
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
230
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
CSC307 Lecture 08
javiergs
PRO
0
670
今から始めるClaude Code超入門
448jp
8
8.7k
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
3.9k
Data-Centric Kaggle
isax1015
2
770
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
2026年 エンジニアリング自己学習法
yumechi
0
130
Featured
See All Featured
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
74
The Cost Of JavaScript in 2023
addyosmani
55
9.5k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
770
How STYLIGHT went responsive
nonsquared
100
6k
How to make the Groovebox
asonas
2
1.9k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
910
The World Runs on Bad Software
bkeepers
PRO
72
12k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
120
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
53
Discover your Explorer Soul
emna__ayadi
2
1.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