Official

Stripe

Connect a Stripe restricted or secret API key to work with customers, products, prices, payment intents, charges, refunds, subscriptions, invoices, payment methods, balances, payouts, disputes, events, Checkout sessions and files.

Read access is the default. Write access adds customer and catalog changes, payment confirmation and capture, refunds, subscription changes, invoice actions, payouts, Checkout and billing portal sessions, and file uploads. Stripe key permissions and account eligibility also apply. Keys select live or test data.

Read access hides credentials that could authorize payments. Payment links can still allow someone to complete a payment, so share them carefully. You can also download files and, with write access, upload them.

This connector uses Stripe's public payments and billing API, pinned to 2026-09-30.endive. It does not manage Atlas incorporation, equity, tax filings or incorporation documents. Those remain in the Atlas Dashboard. Stripe's public API does not document a self-service Atlas interface; a partner integration would need separate access.

Setup instructions

Connect Stripe

  1. In the Stripe Dashboard, select the account and live or sandbox environment. Use a sandbox for testing.
  2. Under API keys, create a restricted key starting with no permissions. Grant Read only for needed resources, or Write where agents should make changes. Related objects may need their own permissions.
  3. Paste the rk_test_ or rk_live_ key into Houston's Stripe API key, choose Read or Write for Access, and save. A secret sk_ key also works; a publishable pk_ key does not.

Live write access can move money and send email. The key's permissions and account eligibility still apply.

Official restricted key guide.

Advanced

If you restrict the key by IP, allow Houston's server egress addresses. Check the account, environment, expiry and permissions when data is unavailable; replace rotated keys in Houston. No OAuth app or Connect platform setup is needed. Atlas incorporation documents remain in the Atlas Dashboard.

Files

  • connector.luau
    -- Stripe API v1, version 2026-09-30.endive. Arguments and results keep Stripe's native field names.
    type Options = {[string]: any}
    type Endpoint = {method: string, path: string, access: string?, required: {string}?, about: string, kind: string?}
    local endpoints: {[string]: Endpoint} = {
    	getAccount = {method = "GET", path = "/v1/account", about = "The account owning the key; not an Atlas company record."},
    	getBalance = {method = "GET", path = "/v1/balance", about = "Available and pending balances by currency."},
    	listBalanceTransactions = {method = "GET", path = "/v1/balance_transactions", about = "Balance ledger; filters include type, payout, source and created."},
    	getBalanceTransaction = {method = "GET", path = "/v1/balance_transactions/{balance_transaction_id}", about = "One balance ledger entry."},
    	listCustomers = {method = "GET", path = "/v1/customers", about = "Customers; filters include email and created."},
    	searchCustomers = {method = "GET", path = "/v1/customers/search", required = {"query"}, about = "Search customers with Stripe search syntax; query required."},
    	getCustomer = {method = "GET", path = "/v1/customers/{customer_id}", about = "One customer."},
    	createCustomer = {method = "POST", path = "/v1/customers", access = "data:write", about = "Create a customer; email, name, metadata and address are optional."},
    	updateCustomer = {method = "POST", path = "/v1/customers/{customer_id}", access = "data:write", about = "Update supplied customer fields."},
    	deleteCustomer = {method = "DELETE", path = "/v1/customers/{customer_id}", access = "data:write", about = "Permanently delete a customer and cancel their subscriptions."},
    	listProducts = {method = "GET", path = "/v1/products", about = "Products; filters include active and created."},
    	getProduct = {method = "GET", path = "/v1/products/{product_id}", about = "One product."},
    	createProduct = {method = "POST", path = "/v1/products", access = "data:write", required = {"name"}, about = "Create a product; name required."},
    	updateProduct = {method = "POST", path = "/v1/products/{product_id}", access = "data:write", about = "Update a product; active=false archives it."},
    	listPrices = {method = "GET", path = "/v1/prices", about = "Prices; filters include product, active, currency and type."},
    	getPrice = {method = "GET", path = "/v1/prices/{price_id}", about = "One price."},
    	createPrice = {method = "POST", path = "/v1/prices", access = "data:write", required = {"currency"}, about = "Create a price; currency and product or product_data required; supply pricing and optional recurring fields."},
    	updatePrice = {method = "POST", path = "/v1/prices/{price_id}", access = "data:write", about = "Update supported price fields, such as active, metadata or nickname; amounts are immutable."},
    	listPaymentIntents = {method = "GET", path = "/v1/payment_intents", about = "Payment intents; filters include customer and created."},
    	getPaymentIntent = {method = "GET", path = "/v1/payment_intents/{payment_intent_id}", about = "One payment intent, including status and client_secret."},
    	createPaymentIntent = {method = "POST", path = "/v1/payment_intents", access = "data:write", required = {"amount", "currency"}, about = "Create an intent; amount and currency required. confirm=true can charge immediately."},
    	updatePaymentIntent = {method = "POST", path = "/v1/payment_intents/{payment_intent_id}", access = "data:write", about = "Update an intent; changes may require confirmation again."},
    	confirmPaymentIntent = {method = "POST", path = "/v1/payment_intents/{payment_intent_id}/confirm", access = "data:write", about = "Attempt payment with payment_method or the intent's existing method; may require customer action."},
    	capturePaymentIntent = {method = "POST", path = "/v1/payment_intents/{payment_intent_id}/capture", access = "data:write", about = "Capture an authorized payment; optional amount_to_capture."},
    	cancelPaymentIntent = {method = "POST", path = "/v1/payment_intents/{payment_intent_id}/cancel", access = "data:write", about = "Cancel an eligible payment intent; optional cancellation_reason."},
    	listCharges = {method = "GET", path = "/v1/charges", about = "Charges; filters include customer, payment_intent and created."},
    	getCharge = {method = "GET", path = "/v1/charges/{charge_id}", about = "One charge, including refund and dispute status."},
    	listRefunds = {method = "GET", path = "/v1/refunds", about = "Refunds; filters include charge, payment_intent and created."},
    	getRefund = {method = "GET", path = "/v1/refunds/{refund_id}", about = "One refund and its status."},
    	createRefund = {method = "POST", path = "/v1/refunds", access = "data:write", about = "Refund a charge/payment_intent, or customer with origin=customer_balance. Optional amount for partial refunds."},
    	updateRefund = {method = "POST", path = "/v1/refunds/{refund_id}", access = "data:write", about = "Update refund metadata."},
    	listSubscriptions = {method = "GET", path = "/v1/subscriptions", about = "Subscriptions; customer, price, status and created filters. Use status=all to include canceled subscriptions."},
    	getSubscription = {method = "GET", path = "/v1/subscriptions/{subscription_id}", about = "One subscription."},
    	createSubscription = {method = "POST", path = "/v1/subscriptions", access = "data:write", about = "Create a subscription with customer or customer_account and items={{price='price_...'}}; can charge immediately."},
    	updateSubscription = {method = "POST", path = "/v1/subscriptions/{subscription_id}", access = "data:write", about = "Update items or cancel_at_period_end; proration_behavior controls prorations and changes can charge."},
    	cancelSubscription = {method = "DELETE", path = "/v1/subscriptions/{subscription_id}", access = "data:write", about = "Cancel immediately; invoice_now and prorate are optional."},
    	listInvoices = {method = "GET", path = "/v1/invoices", about = "Invoices; filters include customer, subscription, status and created."},
    	getInvoice = {method = "GET", path = "/v1/invoices/{invoice_id}", about = "One invoice, including hosted_invoice_url and invoice_pdf when available."},
    	listInvoiceLines = {method = "GET", path = "/v1/invoices/{invoice_id}/lines", about = "Paginated invoice line items."},
    	createInvoice = {method = "POST", path = "/v1/invoices", access = "data:write", about = "Create a draft with customer/customer_account, or revise an invoice with from_invoice."},
    	updateInvoice = {method = "POST", path = "/v1/invoices/{invoice_id}", access = "data:write", about = "Update permitted invoice fields; finalized invoices have restrictions."},
    	finalizeInvoice = {method = "POST", path = "/v1/invoices/{invoice_id}/finalize", access = "data:write", about = "Finalize a draft; auto_advance controls automatic collection."},
    	payInvoice = {method = "POST", path = "/v1/invoices/{invoice_id}/pay", access = "data:write", about = "Attempt invoice payment; can charge a payment method."},
    	sendInvoice = {method = "POST", path = "/v1/invoices/{invoice_id}/send", access = "data:write", about = "Email an invoice to its customer."},
    	voidInvoice = {method = "POST", path = "/v1/invoices/{invoice_id}/void", access = "data:write", about = "Void a finalized invoice; irreversible."},
    	deleteInvoice = {method = "DELETE", path = "/v1/invoices/{invoice_id}", access = "data:write", about = "Delete a draft invoice."},
    	createInvoiceItem = {method = "POST", path = "/v1/invoiceitems", access = "data:write", about = "Create an invoice item; customer or customer_account required; amount or pricing fields determine its value."},
    	listPaymentMethods = {method = "GET", path = "/v1/payment_methods", about = "Payment methods; filter by customer and optional type."},
    	getPaymentMethod = {method = "GET", path = "/v1/payment_methods/{payment_method_id}", about = "One payment method; raw card numbers are not returned."},
    	attachPaymentMethod = {method = "POST", path = "/v1/payment_methods/{payment_method_id}/attach", access = "data:write", about = "Attach an existing payment method to customer or customer_account; use a SetupIntent first when appropriate."},
    	detachPaymentMethod = {method = "POST", path = "/v1/payment_methods/{payment_method_id}/detach", access = "data:write", about = "Detach a payment method; it cannot be used or reattached afterwards."},
    	listPayouts = {method = "GET", path = "/v1/payouts", about = "Payouts; filters include status, destination, arrival_date and created."},
    	getPayout = {method = "GET", path = "/v1/payouts/{payout_id}", about = "One payout."},
    	createPayout = {method = "POST", path = "/v1/payouts", access = "data:write", required = {"amount", "currency"}, about = "Move balance to an external account; amount and currency required."},
    	cancelPayout = {method = "POST", path = "/v1/payouts/{payout_id}/cancel", access = "data:write", about = "Cancel a pending manual payout when eligible."},
    	listDisputes = {method = "GET", path = "/v1/disputes", about = "Disputes; filters include charge, payment_intent and created."},
    	getDispute = {method = "GET", path = "/v1/disputes/{dispute_id}", about = "One dispute with evidence and deadlines."},
    	updateDispute = {method = "POST", path = "/v1/disputes/{dispute_id}", access = "data:write", about = "Update evidence; submit=true submits it to the bank and can be irreversible."},
    	listEvents = {method = "GET", path = "/v1/events", about = "Events from the last 30 days; type, types, created and delivery_success filters. Event payload versions remain as created."},
    	getEvent = {method = "GET", path = "/v1/events/{event_id}", about = "One event from the last 30 days."},
    	listCheckoutSessions = {method = "GET", path = "/v1/checkout/sessions", about = "Checkout sessions; filters include customer, payment_intent, subscription and status."},
    	getCheckoutSession = {method = "GET", path = "/v1/checkout/sessions/{session_id}", about = "One Checkout session."},
    	createCheckoutSession = {method = "POST", path = "/v1/checkout/sessions", access = "data:write", required = {"mode"}, about = "Create hosted checkout; mode payment/subscription/setup, line_items and return URLs depend on mode and ui_mode."},
    	expireCheckoutSession = {method = "POST", path = "/v1/checkout/sessions/{session_id}/expire", access = "data:write", about = "Expire an open Checkout session."},
    	createPortalSession = {method = "POST", path = "/v1/billing_portal/sessions", access = "data:write", about = "Create a billing portal session for customer or customer_account; optional return_url. Returned URL is short-lived."},
    	listFiles = {method = "GET", path = "/v1/files", about = "File metadata; filters include purpose and created."},
    	getFile = {method = "GET", path = "/v1/files/{file_id}", about = "File metadata; url may be absent for files that cannot be downloaded."},
    	uploadFile = {method = "POST", path = "/v1/files", access = "data:write", required = {"purpose"}, kind = "upload", about = "Upload session path with purpose; optional filename/content_type and file_link_data. File size/type limits depend on purpose."},
    	downloadFile = {method = "GET", path = "/v1/files/{file_id}/contents", kind = "download", about = "Download an available file to session path; returns {path,url,size}. Some purposes cannot be downloaded."},
    }
    local NULL = json.decode("null")
    local NONE: {string} = table.freeze({})
    
    local function text(value: any, field: string): string
    	assert(type(value) == "string" and #value > 0, field .. " must be a nonempty string")
    	return value
    end
    
    local function identifier(value: any, field: string): string
    	local result = text(value, field)
    	assert(string.match(result, "^[%w_%-]+$") ~= nil, field .. " must be a Stripe identifier")
    	return result
    end
    
    -- Stripe v1 uses bracketed form fields, including zero-based array indices.
    local function fields(args: Options): {{string}}
    	local result: {{string}} = {}
    	local function add(key: string, value: any, depth: number)
    		assert(depth <= 10, "parameters are nested too deeply")
    		assert(value ~= NULL, key .. " cannot be null; use an empty string to clear a field")
    		if type(value) == "table" then
    			if next(value) == nil then table.insert(result, {key, ""}); return end
    			local array = #value > 0
    			local count = 0
    			for child, item in value do
    				count += 1
    				if array then
    					assert(type(child) == "number" and child % 1 == 0 and child >= 1 and child <= #value, key .. " must be a dense array or object")
    					add(key .. "[" .. tostring(child - 1) .. "]", item, depth + 1)
    				else
    					assert(type(child) == "string" and #child > 0 and not string.find(child, "[%[%]%c]"), key .. " has an invalid field name")
    					add(key .. "[" .. child .. "]", item, depth + 1)
    				end
    			end
    			if array then assert(count == #value, key .. " must be a dense array") end
    		else
    			local kind = type(value)
    			assert(kind == "string" or kind == "boolean" or kind == "number", key .. " must be plain form data")
    			if kind == "number" then assert(value == value and math.abs(value) < math.huge, key .. " must be finite") end
    			table.insert(result, {key, tostring(value)})
    		end
    		assert(#result <= 1000, "too many form fields")
    	end
    	for key, value in args do
    		assert(type(key) == "string" and string.match(key, "^[%a][%w_]*$") ~= nil, "options must have plain named fields")
    		add(key, value, 0)
    	end
    	table.sort(result, function(a, b) return a[1] < b[1] end)
    	return result
    end
    
    local function fail(name: string, response: HttpResponse, message: string): never
    	local retry = response.headers["stripe-should-retry"]
    	local retryable = response.statusCode == 429 or response.statusCode >= 500
    	if retry and retry[1] == "false" then retryable = false end
    	if retry and retry[1] == "true" then retryable = true end
    	return houston.fail({operation = name, layer = "upstream", upstream_status = response.statusCode,
    		retryable = retryable, message = message})
    end
    
    local function check(name: string, response: HttpResponse)
    	if response.statusCode >= 200 and response.statusCode < 300 then return end
    	local raw = await(response.body:readPrefix(8192))
    	local message = string.sub(raw, 1, 1000)
    	local ok, body = pcall(json.decode, raw)
    	if ok and type(body) == "table" and type(body.error) == "table" then
    		local detail = body.error
    		message = string.sub(tostring(detail.message or "Request failed"), 1, 1000)
    		for _, key in {"type", "code", "param"} do
    			if type(detail[key]) == "string" then message ..= " " .. key .. "=" .. string.sub(detail[key], 1, 200) end
    		end
    	end
    	for _, key in {"request-id", "retry-after", "stripe-should-retry", "stripe-rate-limited-reason"} do
    		local values = response.headers[key]
    		if values and values[1] then message ..= " " .. key .. "=" .. string.sub(values[1], 1, 200) end
    	end
    	fail(name, response, "Stripe HTTP " .. response.statusCode .. ": " .. message)
    end
    
    -- Expanded resources and event payloads can contain payment-capable credentials.
    local function redactCredentials(value: any)
    	if type(value) ~= "table" then return end
    	for key, child in value do
    		if key == "client_secret" or key == "confirmation_secret" or key == "client_token" or key == "secret" then
    			value[key] = nil
    		else
    			redactCredentials(child)
    		end
    	end
    end
    
    local function request(name: string, endpoint: Endpoint, input: Options?): any
    	assert(input == nil or type(input) == "table", "opts must be an object")
    	local args: Options = if input then table.clone(input) else {}
    	local path = string.gsub(endpoint.path, "{([%w_]+)}", function(key: string)
    		local value = identifier(args[key], key)
    		args[key] = nil
    		return value
    	end)
    	local required = endpoint.required or NONE
    	for _, key in required do assert(args[key] ~= nil and args[key] ~= NULL and args[key] ~= "", key .. " is required") end
    	if name == "createPrice" then assert(args.product ~= nil or args.product_data ~= nil, "product or product_data is required") end
    	if args.limit ~= nil then assert(type(args.limit) == "number" and args.limit % 1 == 0 and args.limit >= 1 and args.limit <= 100, "limit must be an integer from 1 to 100") end
    	assert(not (args.starting_after ~= nil and args.ending_before ~= nil), "starting_after and ending_before cannot be combined")
    	local headers: HttpHeaders = {Accept = {"application/json"}, ["Stripe-Version"] = {"2026-09-30.endive"}}
    	if args.idempotency_key ~= nil then
    		local key = text(args.idempotency_key, "idempotency_key")
    		assert(endpoint.method == "POST" and #key <= 255 and not string.find(key, "%c"), "idempotency_key requires POST and at most 255 characters without controls")
    		headers["Idempotency-Key"] = {key}
    		args.idempotency_key = nil
    	end
    	local destination: string? = nil
    	local body: any = nil
    	local host = "api.stripe.com"
    	if endpoint.kind == "download" then
    		destination = text(args.path, "path")
    		args.path = nil
    		assert(next(args) == nil, "downloadFile accepts only file_id and path")
    		headers.Accept = {"application/octet-stream"}
    		host = "files.stripe.com"
    	elseif endpoint.kind == "upload" then
    		local source = text(args.path, "path")
    		local filename = text(args.filename or string.match(source, "[^/]+$"), "filename")
    		local contentType = text(args.content_type or "application/octet-stream", "content_type")
    		assert(not string.find(filename, '[%c"/\\]'), "filename must be a plain filename")
    		assert(not string.find(contentType, "%c"), "content_type cannot contain controls")
    		args.path, args.filename, args.content_type = nil, nil, nil
    		assert(args.file == nil, "use path for the upload file")
    		local parts: {any} = {}
    		for _, field in fields(args) do table.insert(parts, {name = field[1], body = field[2]}) end
    		local file = fs.open(source, "r")
    		local ok, form = pcall(function()
    			await(file)
    			table.insert(parts, {name = "file", filename = filename, contentType = contentType, body = file})
    			return multipart.create(parts)
    		end)
    		if not ok then
    			pcall(function() await(file:close()) end)
    			error(form)
    		end
    		body = form.body
    		headers["Content-Type"] = {form.contentType}
    		host = "files.stripe.com"
    	else
    		local encoded: {string} = {}
    		for _, field in fields(args) do table.insert(encoded, url.encode(field[1]) .. "=" .. url.encode(field[2])) end
    		local form = table.concat(encoded, "&")
    		if endpoint.method == "POST" then
    			body = form
    			headers["Content-Type"] = {"application/x-www-form-urlencoded"}
    		elseif #form > 0 then path ..= "?" .. form end
    	end
    	local output = if destination then fs.open(destination, "w") else nil
    	local ok, result = pcall(function()
    		if output then await(output) end
    		local response = await(http.request({method = endpoint.method, url = "https://" .. host .. path, headers = headers, body = body}))
    		check(name, response)
    		if output then
    			output:write(response.body)
    			await(output:close())
    			return {path = destination, size = await(fs.stat(destination :: string)).size, url = await(fs.signedGetUrl(destination :: string))}
    		end
    		local raw = await(response.body:readAll())
    		local decoded, value = pcall(json.decode, raw)
    		if not decoded or type(value) ~= "table" or not string.match(raw, "^%s*{") then fail(name, response, "Stripe returned an invalid JSON object") end
    		if not houston.allows("data:write") then redactCredentials(value) end
    		return value
    	end)
    	if not ok then
    		if endpoint.kind == "upload" then pcall(function() body:close() end) end
    		if output then output:cancel(); pcall(function() await(output:close()) end) end
    		error(result)
    	end
    	return result
    end
    
    local exports: {[string]: any} = {}
    for name, endpoint in endpoints do
    	if not endpoint.access or houston.allows(endpoint.access) then
    		exports[name] = function(args: Options?): any return request(name, endpoint, args) end
    	end
    end
    exports.help = function(): string
    	local lines = {
    		"Stripe API v1 (2026-09-30.endive). Call functions directly, e.g. stripe.listCustomers({limit=25}); do not await connector calls. Each takes one named options object; {field} in the route is required and removed before sending. Remaining options use Stripe's native parameter names and nested tables; results preserve Stripe's JSON objects, arrays and nulls. Full schemas: https://docs.stripe.com/api .",
    		"List functions fetch one page (limit 1..100, Stripe default 10). While has_more, pass the last data item's id as starting_after; ending_before pages backwards and cannot accompany starting_after. Search uses query and page=result.next_page instead, and is eventually consistent. No automatic paging or retries. Small pages and selective expand keep results within runtime memory/response budgets.",
    		"Nested values use Stripe form encoding: {created={gte=1700000000},expand={'data.customer'}}. Empty string clears supported fields; empty tables encode as empty values. JSON null is rejected in requests. Stripe validates resource-specific parameter types and constraints. Amounts use the currency's smallest unit (usually cents); zero-decimal currencies differ.",
    		"Writes appear only with write access. Read-only results remove fields named client_secret, confirmation_secret, client_token and secret at every depth, including events, expansions and metadata, because these can authorize payment or setup. Other fields and all write-access results retain native values. Hosted payment links and personal financial data remain sensitive. A restricted API key must also grant the relevant resource permission. Keys select sandbox/test versus live mode. This connector acts on the key's own account; no per-request Stripe-Account override or Connect account administration.",
    		"For POSTs, supply idempotency_key (at most 255 characters) and keep it with the intended request. Reuse only for an identical retry; Stripe can prune keys after 24 hours. Payments, refunds, payouts, subscription changes and invoice actions can move money or send email. After timeouts or ambiguous writes inspect Stripe before retrying; errors report HTTP status, request-id, retry-after and Stripe retry hints when supplied.",
    		"uploadFile({path='evidence.pdf',purpose='dispute_evidence',content_type='application/pdf'}) streams a session file as multipart. Stripe applies purpose-specific size and file-type limits. downloadFile({file_id='file_...',path='download.pdf'}) streams available contents and returns {path,url,size}, with a signed Houston URL; a failed download leaves the path as it was. getFile exposes availability. Invoice PDF links are returned unchanged, not fetched through arbitrary hosts.",
    		"Atlas incorporation, equity, tax and company documents are not in this public Stripe API connector. No supported public Atlas API was found; partner-only integrations need separate access and documentation. Use the Atlas dashboard for these workflows.",
    	}
    	local names: {string} = {}
    	for name in exports do if name ~= "help" then table.insert(names, name) end end
    	table.sort(names)
    	for _, name in names do
    		local endpoint = endpoints[name]
    		table.insert(lines, name .. "(opts): " .. endpoint.method .. " " .. endpoint.path .. ". " .. endpoint.about)
    	end
    	return table.concat(lines, "\n")
    end
    return exports
    
  • houston.json
    {
      "access": [
        {
          "default": "read",
          "label": "Access",
          "levels": [
            {
              "label": "Read",
              "value": "read"
            },
            {
              "label": "Write",
              "value": "write"
            }
          ],
          "name": "data"
        }
      ],
      "auth": {
        "token": {
          "config": {
            "token": {
              "label": "Restricted or secret API key",
              "required": true,
              "type": "secret"
            }
          },
          "label": "Stripe API key",
          "type": "manual"
        }
      },
      "files": [
        "connector.luau"
      ],
      "icon": "icon.svg",
      "name": "Stripe",
      "proxy": [
        {
          "action": {
            "headers": {
              "remove": [
                "Stripe-Account",
                "Stripe-Context"
              ],
              "set": {
                "Authorization": "Bearer {{auth.token.token}}",
                "Stripe-Version": "2026-09-30.endive"
              }
            }
          },
          "if": "{{ allows access.data \"write\" }}",
          "match": {
            "host": [
              "api.stripe.com"
            ],
            "method": [
              "DELETE"
            ],
            "path": [
              "/v1/customers/{customer_id}",
              "/v1/invoices/{invoice_id}",
              "/v1/subscriptions/{subscription_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "remove": [
                "Stripe-Account",
                "Stripe-Context"
              ],
              "set": {
                "Authorization": "Bearer {{auth.token.token}}",
                "Stripe-Version": "2026-09-30.endive"
              }
            }
          },
          "match": {
            "host": [
              "api.stripe.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/v1/account",
              "/v1/balance",
              "/v1/balance_transactions",
              "/v1/balance_transactions/{balance_transaction_id}",
              "/v1/charges",
              "/v1/charges/{charge_id}",
              "/v1/checkout/sessions",
              "/v1/checkout/sessions/{session_id}",
              "/v1/customers",
              "/v1/customers/search",
              "/v1/customers/{customer_id}",
              "/v1/disputes",
              "/v1/disputes/{dispute_id}",
              "/v1/events",
              "/v1/events/{event_id}",
              "/v1/files",
              "/v1/files/{file_id}",
              "/v1/invoices",
              "/v1/invoices/{invoice_id}",
              "/v1/invoices/{invoice_id}/lines",
              "/v1/payment_intents",
              "/v1/payment_intents/{payment_intent_id}",
              "/v1/payment_methods",
              "/v1/payment_methods/{payment_method_id}",
              "/v1/payouts",
              "/v1/payouts/{payout_id}",
              "/v1/prices",
              "/v1/prices/{price_id}",
              "/v1/products",
              "/v1/products/{product_id}",
              "/v1/refunds",
              "/v1/refunds/{refund_id}",
              "/v1/subscriptions",
              "/v1/subscriptions/{subscription_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "remove": [
                "Stripe-Account",
                "Stripe-Context"
              ],
              "set": {
                "Authorization": "Bearer {{auth.token.token}}",
                "Stripe-Version": "2026-09-30.endive"
              }
            }
          },
          "match": {
            "host": [
              "files.stripe.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/v1/files/{file_id}/contents"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "remove": [
                "Stripe-Account",
                "Stripe-Context"
              ],
              "set": {
                "Authorization": "Bearer {{auth.token.token}}",
                "Stripe-Version": "2026-09-30.endive"
              }
            }
          },
          "if": "{{ allows access.data \"write\" }}",
          "match": {
            "host": [
              "api.stripe.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/v1/billing_portal/sessions",
              "/v1/checkout/sessions",
              "/v1/checkout/sessions/{session_id}/expire",
              "/v1/customers",
              "/v1/customers/{customer_id}",
              "/v1/disputes/{dispute_id}",
              "/v1/invoiceitems",
              "/v1/invoices",
              "/v1/invoices/{invoice_id}",
              "/v1/invoices/{invoice_id}/finalize",
              "/v1/invoices/{invoice_id}/pay",
              "/v1/invoices/{invoice_id}/send",
              "/v1/invoices/{invoice_id}/void",
              "/v1/payment_intents",
              "/v1/payment_intents/{payment_intent_id}",
              "/v1/payment_intents/{payment_intent_id}/cancel",
              "/v1/payment_intents/{payment_intent_id}/capture",
              "/v1/payment_intents/{payment_intent_id}/confirm",
              "/v1/payment_methods/{payment_method_id}/attach",
              "/v1/payment_methods/{payment_method_id}/detach",
              "/v1/payouts",
              "/v1/payouts/{payout_id}/cancel",
              "/v1/prices",
              "/v1/prices/{price_id}",
              "/v1/products",
              "/v1/products/{product_id}",
              "/v1/refunds",
              "/v1/refunds/{refund_id}",
              "/v1/subscriptions",
              "/v1/subscriptions/{subscription_id}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "remove": [
                "Stripe-Account",
                "Stripe-Context"
              ],
              "set": {
                "Authorization": "Bearer {{auth.token.token}}",
                "Stripe-Version": "2026-09-30.endive"
              }
            }
          },
          "if": "{{ allows access.data \"write\" }}",
          "match": {
            "host": [
              "files.stripe.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/v1/files"
            ],
            "protocol": "http"
          }
        }
      ],
      "schema_version": 2
    }
    
  • icon.svgicon.svg
  • README.md
    ---
    description: Read and manage Stripe customers, payments, billing, balances and files.
    ---
    # Stripe
    
    Connect a Stripe restricted or secret API key to work with customers, products,
    prices, payment intents, charges, refunds, subscriptions, invoices, payment methods,
    balances, payouts, disputes, events, Checkout sessions and files.
    
    Read access is the default. Write access adds customer and catalog changes,
    payment confirmation and capture, refunds, subscription changes, invoice actions,
    payouts, Checkout and billing portal sessions, and file uploads. Stripe key
    permissions and account eligibility also apply. Keys select live or test data.
    
    Read access hides credentials that could authorize payments. Payment links
    can still allow someone to complete a payment, so share them carefully. You can
    also download files and, with write access, upload them.
    
    This connector uses Stripe's public payments and billing API, pinned to
    `2026-09-30.endive`. It does not manage Atlas incorporation, equity, tax filings
    or incorporation documents. Those remain in the [Atlas
    Dashboard](https://dashboard.stripe.com/atlas). Stripe's public API does not document
    a self-service Atlas interface; a partner integration would need separate access.
    
  • SETUP.md
    # Connect Stripe
    
    1. In the [Stripe Dashboard](https://dashboard.stripe.com/), select the account
       and live or sandbox environment. Use a sandbox for testing.
    2. Under [API keys](https://dashboard.stripe.com/apikeys), create a restricted
       key starting with no permissions. Grant **Read** only for needed resources,
       or **Write** where agents should make changes. Related objects may need
       their own permissions.
    3. Paste the `rk_test_` or `rk_live_` key into Houston's **Stripe API key**, choose
       **Read** or **Write** for **Access**, and save. A secret `sk_` key also works;
       a publishable `pk_` key does not.
    
    > Live write access can move money and send email. The key's permissions and
    > account eligibility still apply.
    
    [Official restricted key guide](https://docs.stripe.com/keys/restricted-api-keys).
    
    ## Advanced
    
    If you restrict the key by IP, allow Houston's server egress addresses. Check the
    account, environment, expiry and permissions when data is unavailable; replace
    rotated keys in Houston. No OAuth app or Connect platform setup is needed.
    Atlas incorporation documents remain in the [Atlas Dashboard](https://dashboard.stripe.com/atlas/documents).
    
  • tests
    • authentication.luau
      return {
      	contract = function(m)
      		m.authentication({
      			{
      				auth = { token = "synthetic-method-secret" },
      				config = {},
      				endpoint = { "GET", "https://api.stripe.com/v1/balance" },
      				expected = "Bearer synthetic-method-secret",
      				header = "Authorization",
      				method = "token",
      				publisher = {},
      			},
      		})
      	end,
      }
      
    • endpoints.luau
      return {
      	contract = function(m)
      		m.endpointRules()
      	end,
      }
      
    • errors.luau
      return {
      	scenario = {access = {data = "write"}, config = {}, auth_method = "token", auth_config = {token = "rk_test_fixture"}},
      	configure = function()
      		calls, status, payload, responseHeaders = 0, 200, "{}", {}
      		http = {request = function(req)
      			calls += 1
      			return fixture.operation({statusCode=status,headers=responseHeaders,body=fixture.reader(payload)})
      		end}
      	end,
      	run = function(c)
      		local function fails(code, body, headers, expected)
      			status, payload, responseHeaders = code, body, headers
      			local before = calls
      			local ok, err = pcall(c.createRefund,{charge="ch_1",idempotency_key="refund-1"})
      			for _, part in expected do assert(not ok and string.find(tostring(err),part,1,true), tostring(err)) end
      			assert(calls == before + 1, "a financial write was retried")
      		end
      		fails(402,'{"error":{"type":"card_error","code":"card_declined","param":"payment_method","message":"Your card was declined"}}', {["request-id"]={"req_1"}}, {"Stripe HTTP 402","card_declined","payment_method","req_1",'"retryable":false'})
      		fails(403,'{"error":{"message":"Permission denied"}}', {}, {"HTTP 403","Permission denied",'"retryable":false'})
      		fails(429,'{"error":{"type":"rate_limit_error","message":"Slow down"}}', {["retry-after"]={"3"},["stripe-rate-limited-reason"]={"endpoint-rate"}}, {"retry-after=3","endpoint-rate",'"retryable":true'})
      		fails(500,string.rep("X",100000),{["stripe-should-retry"]={"false"}},{"HTTP 500","stripe-should-retry=false",'"retryable":false'})
      		fails(409,'{"error":{"message":"Conflict"}}',{["stripe-should-retry"]={"true"}},{"HTTP 409",'"retryable":true'})
      		fails(200,"not json",{},{"invalid JSON object"})
      		fails(200,"[]",{},{"invalid JSON object"})
      		fails(204,"",{},{"invalid JSON object"})
      	end,
      }
      
    • files.luau
      return {
      	scenario = {access = {data = "write"}, config = {}, auth_method = "token", auth_config = {token = "rk_test_fixture"}},
      	configure = function()
      		requests = {}
      		fs = fixture.files()
      		opened = {}
      		local open = fs.open
      		fs.open = function(path,mode)
      			local file = open(path,mode)
      			table.insert(opened,file)
      			return file
      		end
      		payload = '{"id":"file_1","purpose":"dispute_evidence","url":null}'
      		status = 200
      		stream = nil
      		transportFailure = false
      		admissionFailure = false
      		http = {request=function(req)
      			if admissionFailure then rejectedBody = req.body; error("HTTP admission failed") end
      			if req.body ~= nil and type(req.body) ~= "string" then req.body = await(req.body:readAll()) end
      			table.insert(requests,req)
      			if transportFailure then error("transport failed") end
      			return fixture.operation({statusCode=status,headers={},body=stream or fixture.reader(payload)})
      		end}
      	end,
      	run = function(c)
      		local file = fs.open("input/evidence.pdf","w")
      		file:write("%PDF-fixture\0binary")
      		await(file:close())
      		assert(c.uploadFile({path="input/evidence.pdf",purpose="dispute_evidence",content_type="application/pdf",file_link_data={create=false},idempotency_key="upload-1"}).id == "file_1")
      		local req = requests[1]
      		assert(req.url == "https://files.stripe.com/v1/files" and req.method == "POST" and req.headers.Authorization == nil)
      		assert(req.headers["Idempotency-Key"][1] == "upload-1" and string.find(req.headers["Content-Type"][1],"multipart/form-data",1,true))
      		for _, part in {'name="file"; filename="evidence.pdf"','Content-Type: application/pdf','%PDF-fixture\0binary','name="purpose"\r\n\r\ndispute_evidence','name="file_link_data[create]"\r\n\r\nfalse'} do
      			assert(string.find(req.body,part,1,true), "missing multipart field " .. part)
      		end
      		local before = #requests
      		assert(not pcall(c.uploadFile,{path="missing.pdf",purpose="dispute_evidence"}))
      		assert(not pcall(c.uploadFile,{path="input/evidence.pdf"}))
      		assert(not pcall(c.downloadFile,{file_id="../files",path="bad.pdf"}))
      		assert(#requests == before, "invalid file input reached Stripe")
      		local oversized = {path="input/evidence.pdf",purpose="dispute_evidence"}
      		for i=1,128 do oversized["field_" .. i] = "x" end
      		local ok, err = pcall(c.uploadFile,oversized)
      			assert(not ok and err.code == "invalid_argument" and string.find(err.message,"128 parts",1,true),tostring(err))
      		assert(not pcall(function() await(opened[#opened]:read(1)) end), "multipart validation left the file open")
      		assert(#requests == before, "invalid multipart reached HTTP")
      		admissionFailure = true
      		ok, err = pcall(c.uploadFile,{path="input/evidence.pdf",purpose="dispute_evidence"})
      		assert(not ok and string.find(tostring(err),"HTTP admission failed",1,true),tostring(err))
      			assert(not pcall(function() await(opened[#opened]:read(1)) end), "HTTP admission left the file open")
      			assert(not pcall(function() await(rejectedBody:readAll()) end), "HTTP admission left the multipart reader open")
      		admissionFailure = false
      		local size = 8 * 1024 * 1024 + 17
      		stream = fixture.reader(string.rep("d",size))
      		local saved = c.downloadFile({file_id="file_1",path="output.pdf"})
      		assert(saved.path == "output.pdf" and saved.size == size and type(saved.url) == "string")
      		assert(requests[#requests].url == "https://files.stripe.com/v1/files/file_1/contents")
      		file = fs.open(saved.path,"r")
      		local total = 0
      		while true do
      			local chunk = await(file:read(1024 * 1024))
      			if chunk.done then break end
      			assert(chunk.data == string.rep("d",#chunk.data)); total += #chunk.data
      		end
      		await(file:close()); assert(total == size)
      		stream = gzip.decode(fixture.reader("not gzip"))
      		assert(not pcall(c.downloadFile,{file_id="file_1",path="broken.pdf"}), "broken stream returned success")
      		stream, status, payload = nil, 403, '{"error":{"message":"File cannot be downloaded"}}'
      		ok, err = pcall(c.downloadFile,{file_id="file_1",path="denied.pdf"})
      		assert(not ok and string.find(tostring(err),"File cannot be downloaded",1,true),tostring(err))
      		transportFailure = true
      		ok, err = pcall(c.downloadFile,{file_id="file_1",path="transport.pdf"})
      		assert(not ok and string.find(tostring(err),"transport failed",1,true),tostring(err))
      	end,
      }
      
    • manifest.luau
      return {
      	contract = function(m)
      		-- TestStripeAccessRoutes
      		do
      			local api = "https://api.stripe.com"
      			local files = "https://files.stripe.com"
      			for _, access in { "read", "write" } do
      				local r, err = m.resolve(nil, {}, { token = "rk_test_fixture" }, "token", { data = access })
      				assert(not err, tostring(err))
      				m.routes(r, "Bearer rk_test_fixture", true, {
      					"GET " .. api .. "/v1/account",
      					"GET " .. api .. "/v1/balance",
      					"GET " .. api .. "/v1/customers?limit=10",
      					"GET " .. api .. "/v1/customers/search?query=email",
      					"GET " .. api .. "/v1/invoices/in_1/lines",
      					"GET " .. api .. "/v1/payment_intents/pi_1",
      					"GET " .. api .. "/v1/files/file_1",
      					"GET " .. files .. "/v1/files/file_1/contents",
      				})
      				m.routes(r, "Bearer rk_test_fixture", (access == "write"), {
      					"POST " .. api .. "/v1/payment_intents",
      					"POST " .. api .. "/v1/payment_intents/pi_1/confirm",
      					"POST " .. api .. "/v1/refunds",
      					"POST " .. api .. "/v1/payouts",
      					"POST " .. api .. "/v1/invoices/in_1/send",
      					"DELETE " .. api .. "/v1/customers/cus_1",
      					"DELETE " .. api .. "/v1/subscriptions/sub_1",
      					"POST " .. files .. "/v1/files",
      				})
      				m.routes(r, "Bearer rk_test_fixture", false, {
      					"POST " .. api .. "/v1/files",
      					"GET " .. api .. "/v1/files/file_1/contents",
      					"POST " .. files .. "/v1/refunds",
      					"GET " .. api .. "/v1/api_keys",
      					"POST " .. api .. "/oauth/token",
      					"GET " .. api .. "/v1/atlas/companies",
      					"POST " .. api .. "/v1/accounts",
      					"GET " .. api .. "/v1/accounts/acct_1",
      					"GET " .. api .. "/v1/webhook_endpoints",
      					"GET https://dashboard.stripe.com/atlas",
      					"GET https://api.stripe.com.evil.test/v1/balance",
      					"GET https://files.stripe.com.evil.test/v1/files/file_1/contents",
      					"GET " .. api .. "/v1/customers/%2e%2e/balance",
      					"PUT " .. api .. "/v1/customers/cus_1",
      					"GET " .. api .. "/v2/core/accounts",
      				})
      				for _, rule in m.raw.proxy do
      					if (m.count(rule.match.host) ~= 1) or (m.count(rule.match.method) ~= 1) then
      						m.fail("unexpected broad Stripe rule")
      					end
      				end
      				local recipe, err = m.recipe(r, "GET", api .. "/v1/balance", nil)
      				assert(not err, tostring(err))
      				m.rejectPreparedOverrides(recipe, r.Context, "GET " .. api .. "/v1/balance")
      				local headers, err = m.prepare(recipe, r.Context, {
      					Authorization = { "forged" },
      					["Stripe-Version"] = { "old" },
      					["Stripe-Account"] = { "acct_other" },
      					["Stripe-Context"] = { "acct_other" },
      				})
      				assert(not err, tostring(err))
      				if
      					(m.header(headers, "Stripe-Version") ~= "2026-09-30.endive")
      					or (m.header(headers, "Authorization") ~= "Bearer rk_test_fixture")
      				then
      					m.fail(headers)
      				end
      				for _, header in { "Stripe-Account", "Stripe-Context" } do
      					if m.header(headers, header) ~= "" then
      						m.fail("kept %s", header)
      					end
      				end
      			end
      		end
      	end,
      }
      
    • read_only.luau
      return {
      	scenario = {access = {data = "read"}, config = {}, auth_method = "token", auth_config = {token = "rk_test_fixture"}},
      	configure = function()
      		requests = {}
      		payload = '{"object":"list","data":[{"id":"cus_1","metadata":{"key":"value"}}],"has_more":true}'
      		http = {request = function(req)
      			table.insert(requests, req)
      			return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader(payload)})
      		end}
      	end,
      	run = function(c)
      		local expected = {"getAccount", "getBalance", "listBalanceTransactions", "getBalanceTransaction", "listCustomers", "searchCustomers", "getCustomer", "listProducts", "getProduct", "listPrices", "getPrice", "listPaymentIntents", "getPaymentIntent", "listCharges", "getCharge", "listRefunds", "getRefund", "listSubscriptions", "getSubscription", "listInvoices", "getInvoice", "listInvoiceLines", "listPaymentMethods", "getPaymentMethod", "listPayouts", "getPayout", "listDisputes", "getDispute", "listEvents", "getEvent", "listCheckoutSessions", "getCheckoutSession", "listFiles", "getFile", "downloadFile"}
      		local names = {}
      		for name in c do if name ~= "help" then table.insert(names, name) end end
      		table.sort(names); table.sort(expected)
      		assert(table.concat(names, ",") == table.concat(expected, ","), "unexpected read-only exports")
      		local args = {limit=2, email="a+[email protected]", created={gte=1700000000}, expand={"data.customer"}}
      		local page = c.listCustomers(args)
      		assert(page.data[1].id == "cus_1" and page.data[1].metadata.key == "value" and page.has_more)
      		local req = requests[1]
      		assert(req.url == "https://api.stripe.com/v1/customers?created%5Bgte%5D=1700000000&email=a%2Bb%40example.com&expand%5B0%5D=data.customer&limit=2", req.url)
      		assert(req.method == "GET" and req.body == nil and req.headers.Authorization == nil and req.headers["Stripe-Version"][1] == "2026-09-30.endive")
      		assert(args.limit == 2 and args.expand[1] == "data.customer", "input mutated")
      		payload = '{"object":"list","data":[],"has_more":false}'
      		assert(#c.listCustomers({starting_after="cus_1"}).data == 0)
      		assert(requests[2].url == "https://api.stripe.com/v1/customers?starting_after=cus_1")
      		payload = '{"object":"search_result","data":[],"has_more":false}'
      		c.searchCustomers({query="email:'[email protected]'",page="next_1"})
      		assert(string.find(requests[3].url, "page=next_1&query=",1,true))
      		payload = '{"id":"in_1","amount_due":1234,"customer":null}'
      		assert(c.getInvoice({invoice_id="in_1"}).customer == json.decode("null"))
      		assert(requests[4].url == "https://api.stripe.com/v1/invoices/in_1")
      		payload = '{"object":"list","data":[{"object":"event","data":{"object":{"object":"invoice","confirmation_secret":{"client_secret":"payment-capable"},"payment_intent":{"client_secret":"pi_secret","status":"requires_payment_method"},"subscription":{"pending_setup_intent":{"client_secret":"seti_secret"}},"source":{"klarna":{"client_token":"klarna_secret"}},"metadata":{"note":"keep","secret":"redact"},"hosted_invoice_url":"https://invoice.stripe.com/i/fixture","discounts":[],"description":null}}}],"has_more":false}'
      		local event = c.listEvents().data[1].data.object
      		assert(event.confirmation_secret == nil and event.payment_intent.client_secret == nil and event.payment_intent.status == "requires_payment_method")
      		assert(event.subscription.pending_setup_intent.client_secret == nil and event.source.klarna.client_token == nil)
      		assert(event.metadata.note == "keep" and event.metadata.secret == nil and event.description == json.decode("null"))
      		assert(json.encode(event.discounts) == "[]" and event.hosted_invoice_url == "https://invoice.stripe.com/i/fixture")
      		local before = #requests
      		for _, call in {
      			function() c.getCustomer({customer_id="../balance"}) end,
      			function() c.getCustomer({customer_id="cus_1?x=y"}) end,
      			function() c.getCustomer({}) end,
      			function() c.listCustomers({limit=101}) end,
      			function() c.listCustomers({starting_after="x",ending_before="y"}) end,
      			function() c.listCustomers({["_method"]="POST"}) end,
      			function() c.listCustomers({expand={[1]="a",[3]="b"}}) end,
      			function() c.listCustomers({metadata=json.decode("null")}) end,
      			function() c.listCustomers({idempotency_key="x"}) end,
      			function() c.searchCustomers({}) end,
      		} do assert(not pcall(call), "invalid request accepted") end
      		assert(#requests == before, "invalid input reached network")
      	end,
      }
      
    • writes.luau
      return {
      	scenario = {access = {data = "write"}, config = {}, auth_method = "token", auth_config = {token = "sk_test_fixture"}},
      	configure = function()
      		requests = {}
      		payload = '{"id":"fixture","object":"customer","deleted":true}'
      		http = {request = function(req)
      			table.insert(requests, req)
      			return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader(payload)})
      		end}
      	end,
      	run = function(c)
      		local routes = {
      			createCustomer={"POST","/v1/customers",{}}, updateCustomer={"POST","/v1/customers/cus_1",{customer_id="cus_1"}}, deleteCustomer={"DELETE","/v1/customers/cus_1",{customer_id="cus_1"}},
      			createProduct={"POST","/v1/products",{name="Book"}}, updateProduct={"POST","/v1/products/prod_1",{product_id="prod_1"}},
      			createPrice={"POST","/v1/prices",{currency="usd",product="prod_1",unit_amount=100}}, updatePrice={"POST","/v1/prices/price_1",{price_id="price_1"}},
      			createPaymentIntent={"POST","/v1/payment_intents",{amount=100,currency="usd"}}, updatePaymentIntent={"POST","/v1/payment_intents/pi_1",{payment_intent_id="pi_1"}},
      			confirmPaymentIntent={"POST","/v1/payment_intents/pi_1/confirm",{payment_intent_id="pi_1"}}, capturePaymentIntent={"POST","/v1/payment_intents/pi_1/capture",{payment_intent_id="pi_1"}}, cancelPaymentIntent={"POST","/v1/payment_intents/pi_1/cancel",{payment_intent_id="pi_1"}},
      			createRefund={"POST","/v1/refunds",{charge="ch_1"}}, updateRefund={"POST","/v1/refunds/re_1",{refund_id="re_1"}},
      			createSubscription={"POST","/v1/subscriptions",{customer="cus_1",items={{price="price_1"}}}}, updateSubscription={"POST","/v1/subscriptions/sub_1",{subscription_id="sub_1"}}, cancelSubscription={"DELETE","/v1/subscriptions/sub_1",{subscription_id="sub_1"}},
      			createInvoice={"POST","/v1/invoices",{customer="cus_1"}}, updateInvoice={"POST","/v1/invoices/in_1",{invoice_id="in_1"}}, finalizeInvoice={"POST","/v1/invoices/in_1/finalize",{invoice_id="in_1"}}, payInvoice={"POST","/v1/invoices/in_1/pay",{invoice_id="in_1"}}, sendInvoice={"POST","/v1/invoices/in_1/send",{invoice_id="in_1"}}, voidInvoice={"POST","/v1/invoices/in_1/void",{invoice_id="in_1"}}, deleteInvoice={"DELETE","/v1/invoices/in_1",{invoice_id="in_1"}}, createInvoiceItem={"POST","/v1/invoiceitems",{customer="cus_1",amount=100,currency="usd"}},
      			attachPaymentMethod={"POST","/v1/payment_methods/pm_1/attach",{payment_method_id="pm_1",customer="cus_1"}}, detachPaymentMethod={"POST","/v1/payment_methods/pm_1/detach",{payment_method_id="pm_1"}},
      			createPayout={"POST","/v1/payouts",{amount=100,currency="usd"}}, cancelPayout={"POST","/v1/payouts/po_1/cancel",{payout_id="po_1"}}, updateDispute={"POST","/v1/disputes/dp_1",{dispute_id="dp_1"}},
      			createCheckoutSession={"POST","/v1/checkout/sessions",{mode="payment"}}, expireCheckoutSession={"POST","/v1/checkout/sessions/cs_1/expire",{session_id="cs_1"}}, createPortalSession={"POST","/v1/billing_portal/sessions",{customer="cus_1"}},
      		}
      		for name, route in routes do
      			assert(c[name](route[3]).deleted == true)
      			local req = requests[#requests]
      			assert(req.method == route[1] and req.url == "https://api.stripe.com" .. route[2], name .. ": " .. req.url)
      			assert(req.headers.Authorization == nil and req.headers["Stripe-Version"][1] == "2026-09-30.endive")
      		end
      		local count = 0
      		for name in c do if name ~= "help" then count += 1 end end
      		assert(count == 69 and c.uploadFile and c.downloadFile, "unexpected write surface")
      		payload = '{"id":"pi_1","client_secret":"pi_secret","metadata":{"secret":"native"}}'
      		local native = c.getPaymentIntent({payment_intent_id="pi_1"})
      		assert(native.client_secret == "pi_secret" and native.metadata.secret == "native", "write access changed native fields")
      		c.createSubscription({customer="cus_1",items={{price="price_1",quantity=2},{price="price_2"}},metadata={note="a+b & c"},idempotency_key="sub/customer/1"})
      		local req = requests[#requests]
      		assert(req.headers["Content-Type"][1] == "application/x-www-form-urlencoded" and req.headers["Idempotency-Key"][1] == "sub/customer/1")
      		assert(req.body == "customer=cus_1&items%5B0%5D%5Bprice%5D=price_1&items%5B0%5D%5Bquantity%5D=2&items%5B1%5D%5Bprice%5D=price_2&metadata%5Bnote%5D=a%2Bb%20%26%20c",req.body)
      		c.updateCustomer({customer_id="cus_1",metadata={},description="",invoice_settings={default_payment_method="pm_1"}})
      		assert(requests[#requests].body == "description=&invoice_settings%5Bdefault_payment_method%5D=pm_1&metadata=")
      		c.cancelSubscription({subscription_id="sub_1",invoice_now=true,prorate=false})
      		assert(requests[#requests].url == "https://api.stripe.com/v1/subscriptions/sub_1?invoice_now=true&prorate=false" and requests[#requests].body == nil)
      		c.createSubscription({customer_account="acct_1",items={{price="price_1"}}})
      		assert(requests[#requests].body == "customer_account=acct_1&items%5B0%5D%5Bprice%5D=price_1")
      		c.attachPaymentMethod({payment_method_id="pm_1",customer_account="acct_1"})
      		assert(requests[#requests].body == "customer_account=acct_1")
      		c.createPortalSession({customer_account="acct_1"})
      		assert(requests[#requests].body == "customer_account=acct_1")
      		c.createInvoice({from_invoice={action="revision",invoice="in_1"}})
      		assert(requests[#requests].body == "from_invoice%5Baction%5D=revision&from_invoice%5Binvoice%5D=in_1")
      		c.createRefund({customer="cus_1",origin="customer_balance",amount=100})
      		assert(requests[#requests].body == "amount=100&customer=cus_1&origin=customer_balance")
      		local before = #requests
      		for _, call in {
      			function() c.createPaymentIntent({currency="usd"}) end,
      			function() c.createPrice({currency="usd"}) end,
      			function() c.createCustomer({idempotency_key=string.rep("a",256)}) end,
      			function() c.createCustomer({idempotency_key="a\nb"}) end,
      			function() c.createCustomer({metadata={nested=json.decode("null")}}) end,
      			function() c.createCustomer({metadata={["bad[key]"]="x"}}) end,
      		} do assert(not pcall(call), "invalid input accepted") end
      		assert(#requests == before, "invalid input reached Stripe")
      	end,
      }