The goal of rstripe is to interact with the Stripe API, from R.
It is an independent, community-developed R package for Stripe (not created by or affiliated with Stripe).
You can install the development version of rstripe like so:
pak::pak("nutrivetpet/rstripe")The package requires environment variables for API authentication:
STRIPE_API_KEY_TESTfor test mode operationsSTRIPE_API_KEY_LIVEfor live mode operations
Set these in your .Renviron file with:
# pak::pak("usethis")
usethis::edit_r_environ()Don’t forget to restart R afterwards.
The package currently provides limited but useful coverage of the Stripe API. You can fetch data from these Stripe resources:
library(rstripe)
# Create a client (uses STRIPE_API_KEY_TEST from your environment)
client <- rstripe("test")
# Fetch charges (payments)
charges <- list_charges(client, limit = 10)
# Fetch customers
customers <- list_customers(client, limit = 10)
# Fetch products from your catalog
products <- list_products(client, limit = 10)
# Fetch pricing information
prices <- list_prices(client, limit = 10)
# Fetch invoices
invoices <- list_invoices(client, limit = 10)
# Fetch invoice line items
invoice_items <- list_invoice_items(client, limit = 10)
# Fetch balance transactions
balance_transactions <- list_balance_transactions(client, limit = 10)
# Filter balance transactions by date range
recent_transactions <- list_balance_transactions(
client,
limit = 10,
created_gte = as.Date("2025-01-01"),
created_lte = as.Date("2025-12-31")
)
# For unlimited results, use limit = Inf
all_charges <- list_charges(client, limit = Inf)All functions accept a rstripe client object (created with
rstripe("test") or rstripe("live")), and return data as data frames
(tibbles if the tibble package is installed).