Query the Stripe API

You can use the Stripe API to get customer data for analytics straight into your Quadratic spreadsheet using the Stripe Python Client.

To get started, you'll need your developer key(s): https://dashboard.stripe.com/test/apikeys

IMPORTANT NOTE: we recommend using the "Restricted Keys" feature at the bottom of your Stripe dashboard to only grant the permissions you're okay with having in your spreadsheets. Stripe data can include PII and other harmful data if exposed.

Retrieve customer(s)

# imports
import micropip
await micropip.install('stripe')

from stripe import StripeClient

# WE RECOMMEND USING ONLY TEST KEYS AND/OR RESTRICTED KEYS WITH RESTRICTED ACCESS TO THE PERMISSIONS YOU WANT TO GRANT; STRIPE DATA INCLUDES PII
client = StripeClient("sk_test_...")

# List customers
customers = client.customers.list()

# Print the first customer's email
print(customers.data[0].email)

# Retrieve specific customer
customer = client.customers.retrieve("cus_123456789")

# Print that customer's email
print(customer.email)

Sample sheet: https://app.quadratichq.com/file/90c5e69c-99fa-4ca8-805d-dd27bfb815b1

Need help making this connection? Feel free to reach out to support@quadratichq.com for help.

Quadratic logo

The infinite canvas spreadsheet with code.

Try it now