Skip to content
This repository has been archived by the owner on May 28, 2021. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

An (experimental, toy) library for interfacing with Stripe

This library allows you to call the API from Common Lisp and should nicely present results to you.


  1. Clone this repo
  2. Put it somewhere quicklisp can find it
  3. To use, require it from your ASD system or (ql:quickload :cl-stripe) on the REPL.


All API functions (and data structure accessors) are exported from the stripe package.

The Stripe HTTP API has a few conventions, and so does Common Lisp. To get the two to talk and not cause inconvenience to you, I've implemented a few conventions on the cl-stripe side:

  • Underscores in the HTTP API (e.g., trial_end) become hyphens in the CL API (e.g., trial-end).
  • All responses are returned as stripe:sstruct objects, which are nicely-printing wrappers around st-json:jso (see below).
  • card parameters can be a string to specify a token or a plist containing the fields that specify the card details.
  • All API calls' function names have the form action-object.
  • A call's action is one of retrieve, list, create, update, delete, refund.
  • A call's object is one of charge, customer, token, subscription, plan, invoice, invoice-item.
  • list calls use the plural for objects: customer becomes customers. Other calls use the singular.

That's it. If you keep the Stripe HTTP API open, you should be able to use this library.

Data Structures

Stripe returns (not deeply) nested JSON objects. To make access to each field easier in the absence of a nice hash syntax, cl-stripe provides a function called sstruct-get. It allows you to specify fields that define a chain through the nested object.

For example:

(let ((customers (list-customers)))
  (sstruct-get customers :data 4 :active-card))

This retrieves:

  1. the "data" object from the reply object,
  2. then retrieves the 4th entry from that,
  3. then finally retrieves the "active_card" entry from that.

sstruct-get field names can be specified as keywords (which will be case-normalized to lower case, and hyphens replaced with underscores), or as strings (which will be used verbatim).

API Keys

Your stripe API key is a string you get from your dashboard in the web interface. Set it to either your live or testing key (but please don't blame me if anything goes wrong when you use your live key).

All cl-stripe api functions accept an :api-key keyword argument, which defaults to *default-api-key*. This variable can also be set using the set-default-api-key function.

That's it!

Have fun with this library! I hope you can make something useful with it, and, most importantly, make some money!


A (toy) library for interfacing with from Common Lisp







No releases published


No packages published