Skip to main content

StripeToolkit

A class representing a toolkit for Stripe operations. This toolkit provides methods to interact with the Stripe API, allowing users to operate stripe core resources, including Customer, Balance, BalanceTransaction, Payment, Refund Use the Developers Dashboard https://dashboard.stripe.com/test/apikeys to create an API keys as STRIPE_API_KEY. Parameters:
  • logger (Logger): a logger to write logs.

init

customer_get

Retrieve a customer by ID. Parameters:
  • customer_id (str): The ID of the customer to retrieve.
Returns: str: The customer data as a str.

customer_list

List customers. Parameters:
  • limit (int, optional): Number of customers to retrieve. (default: :obj:100)
Returns: str: An output str if successful, or an error message string if failed.

balance_get

Returns: str: A str containing the account balance if successful, or an error message string if failed.

balance_transaction_list

List your balance transactions. Parameters:
  • limit (int, optional): Number of balance transactions to retrieve. (default::obj:100)
Returns: str: A list of balance transaction data if successful, or an error message string if failed.

payment_get

Retrieve a payment by ID. Parameters:
  • payment_id (str): The ID of the payment to retrieve.
Returns: str:The payment data as a str if successful, or an error message string if failed.

payment_list

List payments. Parameters:
  • limit (int, optional): Number of payments to retrieve. (default::obj:100)
Returns: str: A list of payment data if successful, or an error message string if failed.

refund_get

Retrieve a refund by ID. Parameters:
  • refund_id (str): The ID of the refund to retrieve.
Returns: str: The refund data as a str if successful, or an error message string if failed.

refund_list

List refunds. Parameters:
  • limit (int, optional): Number of refunds to retrieve. (default::obj:100)
Returns: str: A list of refund data as a str if successful, or an error message string if failed.

handle_exception

Handle exceptions by logging and returning an error message. Parameters:
  • func_name (str): The name of the function where the exception occurred.
  • error (Exception): The exception instance.
Returns: str: An error message string.

get_tools

Returns: List[FunctionTool]: A list of FunctionTool objects for the toolkit methods.