Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/manusapis/Agix/llms.txt

Use this file to discover all available pages before exploring further.

The Stripe connector gives Agix direct access to your Stripe account data. Once authenticated, it can pull your full subscriber list, per-customer payment histories, and customer records into the active sheet. From there, Agix’s AI layer can immediately run analyses — churn-risk scoring, cohort lifetime-value estimates, refund-spike detection — without any data export or copy-paste workflow.

StripeConnector class

StripeConnector extends BaseConnector and sets its type to "stripe". It implements the three abstract methods from BaseConnector plus three domain-specific pull methods:
import { BaseConnector } from "./base.connector";
import type { ConnectorConfig, SyncRequest, SyncResult } from "@/types/connector.types";

export class StripeConnector extends BaseConnector {
  constructor() {
    super("stripe");
  }

  async connect(config: ConnectorConfig): Promise<boolean> {
    this.config = config;
    return true;
  }

  async disconnect(): Promise<void> {
    this.config = null;
  }

  async sync(request: SyncRequest): Promise<SyncResult> {
    return {
      connector: "stripe",
      resource: request.resource,
      syncedAt: new Date().toISOString(),
      rowsInserted: 0,
      rowsUpdated: 0,
    };
  }

  async pullSubscriptions(): Promise<Record<string, unknown>[]> { ... }
  async pullPaymentHistory(customerId: string): Promise<Record<string, unknown>[]> { ... }
  async pullCustomers(): Promise<Record<string, unknown>[]> { ... }
}

Pull methods

MethodSignatureWhat it returns
pullSubscriptions() => Promise<Record<string, unknown>[]>All subscription records from your Stripe account
pullPaymentHistory(customerId: string) => Promise<Record<string, unknown>[]>The complete payment history for a single customer
pullCustomers() => Promise<Record<string, unknown>[]>All customer objects from your Stripe account

The sync() method

sync() is the unified entry point used by the Agix scheduler and the sidebar’s one-click sync button. Pass a SyncRequest with connector: "stripe" and set resource to the dataset you want:
import { createConnector } from "@/services/connectors/connector.factory";
import type { SyncRequest } from "@/types/connector.types";

const connector = createConnector("stripe");

await connector.connect({
  type: "stripe",
  name: "My Stripe Account",
  credentials: { apiKey: "rk_live_..." },
  enabled: true,
});

const request: SyncRequest = {
  connector: "stripe",
  resource: "subscriptions",   // or "customers" / "payments"
  since: "2024-01-01T00:00:00Z", // optional: only pull records updated after this date
};

const result = await connector.sync(request);
console.log(`Inserted ${result.rowsInserted}, updated ${result.rowsUpdated}`);
SyncResult reports the outcome:
export interface SyncResult {
  connector: ConnectorType; // "stripe"
  resource: string;         // the resource you requested
  syncedAt: string;         // ISO 8601 timestamp of the sync
  rowsInserted: number;
  rowsUpdated: number;
}

ConnectorConfig for Stripe

The ConnectorConfig passed to connect() holds your Stripe API key inside the credentials map:
const config: ConnectorConfig = {
  type: "stripe",
  name: "Stripe Production",
  credentials: {
    apiKey: "rk_live_...",
  },
  enabled: true,
};
The optional rateLimitRps field lets you throttle outgoing requests if your Stripe plan has tight rate limits.

Example use case: daily churn-risk analysis

A common pattern is to schedule a nightly pull of subscription data, write the rows into a dedicated sheet tab, and then prompt the AI to flag customers with elevated churn risk:
  1. The scheduler triggers sync({ connector: "stripe", resource: "subscriptions" }) at midnight.
  2. rowsInserted and rowsUpdated counts confirm the sheet is current.
  3. You open the Agix sidebar and type: “Which subscribers have been on a monthly plan for over 12 months with no upgrade? Rank them by churn risk.”
  4. Agix reads the fresh subscription rows and writes a ranked table with reasoning into the adjacent sheet.
No data pipeline, no warehouse, no dashboard tool — just Stripe data in cells with an AI ready to reason about it.

How to connect Stripe

1

Create a restricted Stripe API key

Log in to dashboard.stripe.com, navigate to Developers → API keys, and click Create restricted key. Grant Read access to Customers, Subscriptions, and Charges only. Copy the key — it starts with rk_.
2

Open the Agix Integrations panel

In your spreadsheet, open the Agix sidebar and navigate to Integrations → Stripe.
3

Enter the API key

Paste the restricted API key into the API Key field and click Save.
4

Choose a resource

Select the dataset you want to pull: Subscriptions, Customers, or Payments.
5

Sync data into the active sheet

Click Sync. Agix calls StripeConnector.sync() and writes the results into the currently active sheet, starting from cell A1. The status bar shows the number of rows inserted and updated when the sync completes.
Always use a restricted Stripe API key with read-only permissions, never a secret key (sk_live_...). A secret key grants full write access to your Stripe account — including the ability to issue refunds and modify customers. Agix only needs to read data; a restricted read-only key is sufficient and significantly limits blast radius if credentials are ever exposed.

Build docs developers (and LLMs) love