Building Stripe's API

Amber Feng
February 21, 2013

Building Stripe's API

How we built the Stripe API: lessons learned, and things we did to make the API as easy to use as possible.

Amber Feng

February 21, 2013

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

33 slides
  1. PAYMENTS API CREDIT CARD PAYMENTS TOKENIZED & STORED CARDS RECURRING

    BILLING > curl https://api.stripe.com/v1/charges \ -u sk_test_mkGsLqEW6SLnZa487HYfJVLf: \ -d amount=400 \ -d currency=usd \ -d "card[number]=4242424242424242" \ -d "card[exp_month]=12" \ -d "card[exp_year]=2014" \ -d "card[cvc]=123"
  2. RPC ORIENTED ◦ method=list_charges ◦ All calls are POST, and

    return 200 POST /v0?method=list_charges &key=KEY v0 API (2010, beta)
  3. HTTP ORIENTED ◦ GET, POST, DELETE ◦ HTTP status code

    to indicate result GET /v1/charges?count=60 -u KEY: v1 API
  4. LET USERS BUILD EXTENSIONS WEBHOOKS ◦ Posted events to a

    webhook URL ◦ charge.succeeded, charge.refunded, etc. CONNECT ◦ OAuth2 API ◦ Users can authorize access to their Stripe accounts ◦ Full access to Stripe API
  5. { "error": { "message": "You must provide an integer value

    for 'exp_year'.", "type": "card_error", "param": "exp_year" } }
  6. >> Stripe::Customer.create Stripe::AuthenticationError: No API key provided. (HINT: set your

    API key using "Stripe.api_key = <API-KEY>". You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email [email protected] if you have any questions.)
  7. >> Stripe.api_key = TEST_KEY => ... >> Stripe::Charge.retrieve(LIVE_CHARGE_ID) Stripe::InvalidRequestError: (Status

    404) No such charge: ch_17SOe5QQ2exd2S; a similar object exists in live mode, but a test mode key was used to make this request.
  8. BACKWARDS INCOMPATIBLE CHANGES ◦ Per-user version, set on first API

    call ◦ Allow upgrading versions and detailed changelog ◦ Pass version override in headers FEATURE GATING ◦ Experimental or one-off ◦ shows_applications VERSIONING

More Decks by Amber Feng

Other Decks in Programming