Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How Spotify Payments Creates APIs to Manage Com...

Avatar for Horia Jurcut Horia Jurcut
November 10, 2016

How Spotify Payments Creates APIs to Manage Complexity

Spotify is one of the world leaders in media subscriptions and is the largest music streaming service with over 30 million paying subscribers. We currently provide 16 different methods of payment in over 60 countries and we continue to expand our offerings.

In this session we are going to talk about engineering an internal API to abstract away from the complexities of multiple payment gateways and multiple clients with potentially long release cycles (iOS, Android). I will share some of the benefits of growing the API organically, and some of the downfalls of premature abstraction.

Avatar for Horia Jurcut

Horia Jurcut

November 10, 2016

More Decks by Horia Jurcut

Other Decks in Technology

Transcript

  1. Credit Cards 2008 PayPal 2011 Finland France Norway Spain Sweden

    2008 Austria Belgium Denmark Great Britain Switzerland The Netherlands USA 2011 2006 Initial launch Growth 2016
  2. Credit Cards 2008 PayPal 2011 Finland France Norway Spain Sweden

    2008 Austria Belgium Denmark Great Britain Switzerland The Netherlands USA 2011 2006 Initial launch Growth Boku Sofort Klarna Google iAP Facebook payments 2013 Argentina Australia Colombia Hong Kong Ireland Germany ... 2013 + 37 markets Global Company 2016
  3. Credit Cards 2008 PayPal 2011 Finland France Norway Spain Sweden

    2008 Austria Belgium Denmark Great Britain Switzerland The Netherlands USA 2011 2006 Initial launch Growth Boku Sofort Klarna Google iAP Facebook payments 2013 Argentina Australia Colombia Hong Kong Ireland Germany ... 2013 + 37 markets Global Company Adyen PaySafe Card Oxxo iDeal dotPay DragonPay SafetyPay DirectDebit Boleto iOS iAP 2015 Brazil Canada Philippines 2015 Localization 2016
  4. Credit Cards 2008 PayPal 2011 Finland France Norway Spain Sweden

    2008 Austria Belgium Denmark Great Britain Switzerland The Netherlands USA 2011 2006 Initial launch Growth Boku Sofort Klarna Google iAP Facebook payments 2013 Argentina Australia Colombia Hong Kong Ireland Germany ... 2013 + 37 markets Global Company Adyen PaySafe Card Oxxo iDeal dotPay DragonPay SafetyPay DirectDebit Boleto iOS iAP 2015 Localization Fortumo Doku econtext 2016 40 million subscribers 2016 Indonesia Japan 2016 60 markets 2016 Optimization Brazil Canada Philippines 2015
  5. Bank Users 1 Checkout Go to spotify.com Validate card 2

    Payment Backend Payments @ Spotify
  6. Bank Users 1 Checkout Payment Provider Go to spotify.com Validate

    details Authorize payment 2 Payment Backend Payments @ Spotify
  7. Bank Users 1 Checkout Payment Provider Credit Network Go to

    spotify.com Validate card Contact bank 2 Authorize payment Payment Backend Payments @ Spotify
  8. Bank Users 1 Checkout Payment Provider Credit Network Go to

    spotify.com Validate card Valid card Contact bank Authorize payment Valid card 2 3 Payment Backend Payments @ Spotify
  9. Bank Users 1 Checkout Payment Provider Credit Network Go to

    spotify.com Validate card Valid card Contact bank Authorize payment Valid card Access to Spotify Premium 2 3 Payment Backend Payments @ Spotify
  10. Success CC Form Tax Info CC Form Confirmation Tax Info

    Required in some countries Checkout API
  11. Success CC Form Tax Info CC Form Confirmation Tax Info

    Required in some countries Payment Backend Checkout API Clients
  12. Success Billing Address CC Form Tax Info CC Form Confirmation

    Tax Info Required in some countries Billing Address Payment Backend Checkout API Clients
  13. Success Billing Address CC Form Tax Info Offer Code One

    Time Code X3G6D8A7 CC Form Confirmation Tax Info Required in some countries Billing Address Payment Backend Checkout API Clients
  14. Checkout API Success Billing Address CC Form Tax Info Offer

    Code One Time Code X3G6D8A7 CC Form Confirmation Tax Info Required in some countries Billing Address Payment Backend Checkout API Clients
  15. Checkout API Checkout API Start purchase What is the first

    step? Collect CC Information Display CC Form CC Form
  16. Checkout API Checkout API Start purchase What is the first

    step? Collect CC Information Display CC Form CC Form CC Form Send credit card data Send credit card data
  17. Checkout API Checkout API Start purchase What is the first

    step? Collect CC Information Display CC Form CC Form CC Form Confirmation Show Confirmation Display Confirmation Send credit card data Send credit card data
  18. Checkout API Checkout API Start purchase What is the first

    step? Collect CC Information Display CC Form CC Form Send credit card data Send credit card data Confirmation Show Confirmation Display Confirmation CC Form One Time Code X3G6D8A7
  19. Advantages Spotify Payments • Change checkout experience without client release

    • Clients can build native experiences • Consolidated business logic • Rapidly test, experiment and learn • Mix & Match
  20. Billing API Payment Backend Clients Checkout API Adyen PayPal Klarna

    Billing API charge success Payment Providers
  21. Billing API Payment Backend Clients Checkout API Adyen PayPal Klarna

    Billing API charge success Payment Providers Financial Data Settlement Reconciliation Callbacks Monitoring
  22. Billing API Payment Backend Clients Checkout API Adyen PayPal Klarna

    Billing API charge success Payment Providers Financial Data Settlement Reconciliation Callbacks Monitoring
  23. Monitoring Billing API { "message": "payment_received", "provider": "adyen", "method": "cards",

    "amount: "9.99", "currency": "USD", "country": "US", "product_type": "premium", "duration:" 1, "duration_type": "month", "reference": "9107771201", } { "message": "payment_failed", "provider": "adyen", "method": "cards", "amount: "9.99", "currency": "USD", "country": "US", "product_type": "premium", "duration:" 1, "duration_type": "month", "reference": "9108771203", "failure_code": "399", }
  24. Automatic Alerts Payment transactions processed (initial payments) Payment transactions failed

    (initial payments) Broke initial payments Provider had an issue
  25. Automatic Alerts Payment transactions processed (initial payments) Payment transactions failed

    (initial payments) Broke initial payments Provider had an issue Other providers continued working
  26. Advantages Spotify Payments • Fairly low number of false positives

    • Works very well for high volume providers (Adyen) • Become more aware of local events
  27. Why we build APIs Spotify Payments • Many clients, many

    providers • Integrate with other internal systems • More complex products and business rules • Customization
  28. My time @ Spotify Spotify Payments • APIs make it

    easier for multiple teams to collaborate • APIs help you take a hard problem and divide it into more manageable domains • APIs require documentation • APIs enable you to rapidly test, experiment and learn