Stripe

Learn how to use Stripe with Composio

Overview

SLUG: STRIPE

Description

Stripe offers online payment infrastructure, fraud prevention, and APIs enabling businesses to accept and manage payments globally

Authentication Details

generic_api_key
stringRequired

Connecting to Stripe

Create an auth config

Use the dashboard to create an auth config for the Stripe toolkit. This allows you to connect multiple Stripe accounts to Composio for agents to use.

1

Select App

Navigate to the Stripe toolkit page and click “Setup Integration”.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Integration”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using API Key

1from composio import Composio
2from composio.types import auth_scheme
3
4# Replace these with your actual values
5stripe_auth_config_id = "ac_YOUR_STRIPE_CONFIG_ID" # Auth config ID created above
6user_id = "0000-0000-0000" # UUID from database/app
7
8composio = Composio()
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 # Replace this with a method to retrieve an API key from the user.
12 # Or supply your own.
13 user_api_key = input("[!] Enter API key")
14
15 connection_request = composio.connected_accounts.initiate(
16 user_id=user_id,
17 auth_config_id=auth_config_id,
18 config={"auth_scheme": "API_KEY", "val": user_api_key}
19 )
20
21 # API Key authentication is immediate - no redirect needed
22 print(f"Successfully connected Stripe for user {user_id}")
23 print(f"Connection status: {connection_request.status}")
24
25 return connection_request.id
26
27
28connection_id = authenticate_toolkit(user_id, stripe_auth_config_id)
29
30# You can verify the connection using:
31connected_account = composio.connected_accounts.get(connection_id)
32print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Stripe toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["STRIPE"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Cancel subscription

Description

Cancels a customer's active stripe subscription at the end of the current billing period, with options to invoice immediately for metered usage and prorate charges for unused time.

Action Parameters

cancellation_details
object
invoice_now
boolean
prorate
boolean
subscription_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Customer

Description

Creates a new customer in stripe, required for creating charges or subscriptions; an email is highly recommended for customer communications.

Action Parameters

address
object
description
string
email
string
name
string
phone
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create an invoice

Description

Creates a new draft stripe invoice for a customer; use to revise an existing invoice, bill for a specific subscription (which must belong to the customer), or apply detailed customizations.

Action Parameters

account_tax_ids
array
application_fee_amount
integer
auto_advance
boolean
automatic_tax
object
automatically_finalizes_at
integer
collection_method
string
currency
string
custom_fields
array
customer
stringRequired
days_until_due
integer
default_payment_method
string
default_source
string
default_tax_rates
array
description
string
discounts
array
due_date
integer
footer
string
from_invoice
object
issuer
object
metadata
object
number
string
on_behalf_of
string
payment_settings
object
pending_invoice_items_behavior
string
rendering
object
shipping_cost
object
shipping_details
object
statement_descriptor
string
subscription
string
transfer_data
object

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create payment intent

Description

Creates a stripe paymentintent to initiate and process a customer's payment; using `application fee amount` for a connected account requires the `stripe-account` header.

Action Parameters

amount
integerRequired
application_fee_amount
integer
automatic_payment_methods
object
confirm
boolean
currency
stringRequired
customer
string
description
string
metadata
object
off_session
boolean
payment_method
string
payment_method_options
object
payment_method_types
array
receipt_email
string
return_url
string
setup_future_usage
string
shipping
object
statement_descriptor
string
statement_descriptor_suffix
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create a price

Description

Creates a new stripe price for a product, defining its charges (one-time or recurring) and billing scheme; requires either an existing `product` id or `product data`.

Action Parameters

active
booleanDefaults to True
billing_scheme
string
currency
stringRequired
currency_options
object
custom_unit_amount
object
lookup_key
string
metadata
object
nickname
string
product
string
product_data
object
recurring
object
tax_behavior
string
tiers
array
tiers_mode
string
transfer_lookup_key
boolean
transform_quantity
object
unit_amount
integer
unit_amount_decimal
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create product

Description

Creates a new product in stripe, encoding the request as `application/x-www-form-urlencoded` by flattening nested structures.

Action Parameters

active
booleanDefaults to True
custom_fields
array
default_price_data
object
description
string
id
string
images
array
marketing_features
array
metadata
object
name
stringRequired
package_dimensions
object
shippable
boolean
shipping_cost
object
statement_descriptor
string
tax_code
string
unit_label
string
url
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Refund

Description

Creates a full or partial refund in stripe, targeting either a specific charge id or a payment intent id.

Action Parameters

amount
integer
charge
string
metadata
object
payment_intent
string
reason
string
refund_application_fee
boolean
reverse_transfer
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create subscription

Description

Creates a new, highly configurable subscription for an existing stripe customer, supporting multiple items, trials, discounts, and various billing/payment options.

Action Parameters

add_invoice_items
array
application_fee_percent
number
automatic_tax
object
backdate_start_date
integer
billing_cycle_anchor
integer
billing_cycle_anchor_config
object
billing_thresholds
object
cancel_at
integer
cancel_at_period_end
boolean
collection_method
stringDefaults to charge_automatically
currency
string
customer
stringRequired
days_until_due
integer
default_payment_method
string
default_source
string
default_tax_rates
array
description
string
discounts
array
invoice_settings
object
items
arrayRequired
metadata
object
off_session
boolean
on_behalf_of
string
payment_behavior
string
payment_settings
object
pending_invoice_item_interval
object
promotion_code
string
proration_behavior
string
transfer_data
object
trial_end
integer
trial_from_plan
boolean
trial_period_days
integer
trial_settings
object

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete customer

Description

Permanently deletes an existing stripe customer; this irreversible action also cancels their active subscriptions and removes all associated data.

Action Parameters

customer_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List customer payment methods

Description

Retrieves a list of payment methods for a given customer, supporting type filtering and pagination.

Action Parameters

customer_id
stringRequired
ending_before
string
limit
integer
starting_after
string
type
string

Action Response

data
arrayRequired
error
string
has_more
booleanRequired
object
stringDefaults to list
successful
booleanRequired
url
stringRequired

Tool Name: List Refunds

Description

Lists stripe refunds, sorted by creation date descending (newest first), with optional filtering by charge or payment intent and pagination support.

Action Parameters

charge
string
ending_before
string
limit
integer
payment_intent
string
starting_after
string

Action Response

data
arrayRequired
error
string
has_more
booleanRequired
object
stringRequired
successful
booleanRequired
url
stringRequired

Tool Name: List Stripe shipping rates

Description

Retrieves a list of stripe shipping rates, filterable by active status, creation date, and currency; useful for managing or displaying shipping options.

Action Parameters

active
boolean
created
object
currency
string
ending_before
string
limit
integer
starting_after
string

Action Response

data
arrayRequired
error
string
has_more
booleanRequired
object
stringRequired
successful
booleanRequired
url
stringRequired

Tool Name: List tax rates

Description

Retrieves a list of tax rates, which are returned sorted by creation date in descending order.

Action Parameters

active
boolean
created
object
ending_before
string
inclusive
boolean
limit
integer
starting_after
string

Action Response

data
arrayRequired
error
string
has_more
booleanRequired
object
stringRequired
successful
booleanRequired
url
stringRequired

Tool Name: Retrieve Charge Details

Description

Retrieves full details for an existing stripe charge using its unique id.

Action Parameters

charge_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve payment intent

Description

Retrieves a paymentintent by its id; `client secret` is required if a publishable api key is used.

Action Parameters

client_secret
string
payment_intent_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve a refund

Description

Retrieves details for an existing stripe refund using its unique `refund id`.

Action Parameters

refund_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Search Stripe customers

Description

Retrieves a list of stripe customers matching a search query that adheres to stripe's search query language.

Action Parameters

limit
integer
page
string
query
stringRequired

Action Response

data
arrayRequired
error
string
has_more
booleanRequired
next_page
string
object
stringDefaults to search_result
successful
booleanRequired
url
stringRequired

Tool Name: Update Payment Intent

Description

Updates a stripe paymentintent with new values for specified parameters; note that if `currency` is updated, `amount` might also be required, and certain updates (e.g., to `payment method`) can necessitate re-confirmation by the customer.

Action Parameters

amount
integer
currency
string
customer
string
description
string
metadata
object
payment_intent_id
stringRequired
payment_method
string
receipt_email
string
setup_future_usage
string
shipping
object
statement_descriptor
string
statement_descriptor_suffix
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Subscription

Description

Updates an existing, non-canceled stripe subscription by its id, ensuring all referenced entity ids (e.g., prices, coupons) are valid and automatic tax liability is correctly specified if enabled.

Action Parameters

automatic_tax
object
billing_cycle_anchor
integer
cancel_at_period_end
boolean
collection_method
string
default_payment_method
string
description
string
items
array
metadata
object
payment_behavior
string
proration_behavior
string
subscription_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Confirm payment intent

Description

Confirms a stripe paymentintent to finalize a payment; a `return url` is necessary if the payment method requires customer redirection.

Action Parameters

capture_method
string
payment_intent_id
stringRequired
payment_method
string
receipt_email
string
return_url
string
setup_future_usage
string
shipping
object

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Charges

Description

Retrieves a list of stripe charges with filtering and pagination; use valid cursor ids from previous responses for pagination, and note that charges are typically returned in reverse chronological order.

Action Parameters

created
object
customer
string
ending_before
string
limit
integer
payment_intent
string
starting_after
string
transfer_group
string

Action Response

data
arrayRequired
error
string
successful
booleanRequired

Tool Name: List Stripe coupons

Description

Retrieves a list of discount coupons from a stripe account, supporting pagination via `limit`, `starting after`, and `ending before`.

Action Parameters

ending_before
string
limit
integer
starting_after
string

Action Response

data
arrayRequired
error
string
has_more
booleanRequired
object
stringRequired
successful
booleanRequired
url
stringRequired

Tool Name: List customers

Description

Retrieves a list of stripe customers, with options to filter by email, creation date, or test clock, and support for pagination.

Action Parameters

created
object
email
string
ending_before
string
limit
integer
starting_after
string
test_clock
string

Action Response

data
arrayRequired
error
string
successful
booleanRequired

Tool Name: List Invoices

Description

Retrieves a list of stripe invoices, filterable by various criteria and paginatable using invoice id cursors obtained from previous responses.

Action Parameters

collection_method
string
created
object
customer
string
ending_before
string
limit
integer
starting_after
string
status
string
subscription
string

Action Response

data
arrayRequired
error
string
successful
booleanRequired

Tool Name: List payment intents

Description

Retrieves a list of stripe paymentintents, optionally filtered and paginated using paymentintent ids as cursors.

Action Parameters

created
object
customer
string
ending_before
string
limit
integer
starting_after
string

Action Response

data
arrayRequired
error
string
successful
booleanRequired

Tool Name: List products

Description

Retrieves a list of stripe products, with optional filtering and pagination; `starting after`/`ending before` cursors must be valid product ids from a previous response.

Action Parameters

active
boolean
created
object
ending_before
string
ids
array
limit
integer
shippable
boolean
starting_after
string
url
string

Action Response

data
arrayRequired
error
string
successful
booleanRequired

Tool Name: List subscriptions

Description

Retrieves a list of stripe subscriptions, optionally filtered by various criteria such as customer, price, status, collection method, and date ranges, with support for pagination.

Action Parameters

automatic_tax
object
collection_method
string
created
object
current_period_end
object
current_period_start
object
customer
string
ending_before
string
limit
integer
price
string
starting_after
string
status
string
test_clock
string

Action Response

data
arrayRequired
error
string
successful
booleanRequired

Tool Name: List tax codes

Description

Retrieves a paginated list of globally available, predefined stripe tax codes used for classifying products and services in stripe tax.

Action Parameters

ending_before
string
limit
integer
starting_after
string

Action Response

data
arrayRequired
error
string
has_more
booleanRequired
object
stringRequired
successful
booleanRequired
url
stringRequired

Tool Name: Retrieve Balance

Description

Retrieves the complete current balance details for the connected stripe account.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve customer

Description

Retrieves detailed information for an existing stripe customer using their unique customer id.

Action Parameters

customer_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Retrieve subscription

Description

Retrieves detailed information for an existing stripe subscription using its unique id.

Action Parameters

subscription_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Customer

Description

Updates an existing stripe customer, identified by customer id, with only the provided details; unspecified fields remain unchanged.

Action Parameters

address
object
balance
integer
coupon
string
customer_id
stringRequired
default_payment_method
string
default_source
string
description
string
email
string
invoice_settings
object
metadata
object
name
string
phone
string
shipping
object
tax
object
tax_exempt
string

Action Response

data
objectRequired
error
string
successful
booleanRequired