Files
crewAI/docs/edge/pt-BR/enterprise/integrations/stripe.mdx
Lucas Gomide a237ebabba feat: adopt directory-based docs versioning with Edge channel (#6202)
* feat: adopt directory-based docs versioning with Edge channel

Switch docs.crewai.com from navigation-only versioning (every version
selector entry rendered the same docs/<lang>/* source files) to
Mintlify's directory-based versioning so each version selector entry
renders its own snapshot. Add an "Edge" channel under docs/edge/<lang>/*
that always reflects main HEAD for unreleased work, eliminating
pre-release leakage onto frozen release labels. External links to
canonical /<lang>/* URLs are preserved via wildcard redirects that
always land on the current default version.

Layout:
- docs/edge/<lang>/*         rolling source (you edit here)
- docs/edge/enterprise-api.*.yaml
- docs/v<X.Y.Z>/<lang>/*     frozen, immutable snapshots
- docs/v<X.Y.Z>/enterprise-api.*.yaml
- docs/images/               shared, append-only
- docs/docs.json             nav + redirects

URLs follow the Mintlify-idiomatic shape: /edge/<lang>/<page> for
Edge, /v<X.Y.Z>/<lang>/<page> for every frozen snapshot. The wildcard
redirects /<lang>/:slug* -> /<default>/<lang>/:slug* keep stale links
working, and every freeze rewrites them (plus all per-section/per-page
redirects) so destinations always resolve to the current default
without depending on a second redirect hop.

Release flow integration (devtools release):
- New module crewai_devtools.docs_versioning.freeze() materialises
  docs/v<X.Y.Z>/ from docs/edge/, rewrites openapi: refs inside the
  snapshot, inserts the version into every language block in
  docs.json, and refreshes all redirect destinations.
- _update_docs_and_create_pr() in cli.py now calls that freeze during
  Phase 2 of devtools release. Edge changelogs are updated first (so
  the snapshot freeze picks them up), then the snapshot is staged
  alongside docs.json, branched as docs/freeze-v<X.Y.Z>, and the PR
  is titled [docs-freeze] docs: snapshot and changelog for v<X.Y.Z>
  — the title prefix the new CI guard reads.
- The PR still gates tag, GitHub release, PyPI publish, and the
  enterprise release as before; no new PRs are added.
- Pre-releases (1.X.YaN, 1.X.YbN, ...) skip the snapshot — they ride
  Edge — and the docs PR title omits the [docs-freeze] prefix.
- docs_check (AI-generated docs scaffolding) writes to
  docs/edge/<lang>/* so newly-generated unreleased docs land in Edge
  and never accidentally touch a frozen snapshot.

Migration scripts (one-shot):
- scripts/docs/freeze_historical_versions.py reconstructs all 16
  historical snapshots (v1.10.0 .. v1.14.7) from git tags via
  git archive | tar, rewriting openapi: MDX refs so each snapshot
  reads its own enterprise-api YAML rather than the live one.
- scripts/docs/prefix_version_paths.py one-shot-migrates docs.json:
  rewrites every page path in 16 versioned blocks to point under
  docs/v<X.Y.Z>/, inserts a new Edge entry per language, tags
  v1.14.7 as Latest (default), prunes pages whose target file
  doesn't exist in the snapshot (e.g. docs/ar/ didn't exist before
  v1.12.0), and writes the wildcard + per-section redirects.
- scripts/docs/freeze_current_edge.py is now a thin CLI wrapper
  around docs_versioning.freeze for manual one-off freezes (e.g.
  retroactively snapshotting a forgotten release).

CI guards (.github/workflows/docs-snapshots.yml):
- Frozen snapshots under docs/v[0-9]*/ are immutable; only PRs whose
  title contains [docs-freeze] (i.e. release-cut PRs generated by
  devtools release or the manual wrapper) may modify them.
- Images under docs/images/ are append-only since snapshots share a
  single image directory. Deleting or renaming an image breaks every
  historical snapshot that still references it.

Restored docs/images/crewai-otel-export.png from PR #3673; it was
deleted in PR #4908 but v1.10.0 / v1.10.1 snapshots still reference
it. Restoring instead of editing the snapshots preserves historical
rendering fidelity and validates the new append-only rule
retroactively.

Tests:
- lib/devtools/tests/test_docs_versioning.py covers the freeze: file
  copy, openapi rewrite, version insertion, default demotion, redirect
  upserts, per-section redirect rewriting, idempotency, and invalid
  inputs.

Verified locally with mintlify broken-links: 0 broken links across
the full site (Edge + 16 frozen versions, 4 locales).

AGENTS.md (repo root) is the contributor guide for the new model;
RELEASING.md is the release-cut runbook; README's Contribution
section links to both.

Co-authored-by: Cursor <cursoragent@cursor.com>

* style: resolve linter issues

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:56:59 -04:00

328 lines
11 KiB
Plaintext

---
title: Integração Stripe
description: "Processamento de pagamentos e gerenciamento de assinaturas com integração Stripe para CrewAI."
icon: "stripe"
mode: "wide"
---
## Visão Geral
Permita que seus agentes gerenciem pagamentos, assinaturas e faturamento de clientes através do Stripe. Gerencie dados de clientes, processe assinaturas, gerencie produtos e acompanhe transações financeiras para otimizar seus fluxos de pagamento com automação impulsionada por IA.
## Pré-requisitos
Antes de usar a integração com o Stripe, certifique-se de que você tem:
- Uma conta [CrewAI AMP](https://app.crewai.com) com uma assinatura ativa
- Uma conta Stripe com permissões apropriadas de API
- Sua conta Stripe conectada através da [página de Integrações](https://app.crewai.com/integrations)
## Configurando a Integração Stripe
### 1. Conecte sua Conta Stripe
1. Acesse [CrewAI AMP Integrações](https://app.crewai.com/crewai_plus/connectors)
2. Encontre **Stripe** na seção Integrações de Autenticação
3. Clique em **Conectar** e complete o fluxo OAuth
4. Conceda as permissões necessárias para processamento de pagamentos
5. Copie seu Token Enterprise em [Configurações de Integração](https://app.crewai.com/crewai_plus/settings/integrations)
### 2. Instale o Pacote Necessário
```bash
uv add crewai-tools
```
### 3. Configuração de variável de ambiente
<Note>
Para usar integrações com `Agent(apps=[])`, você deve definir a variável de
ambiente `CREWAI_PLATFORM_INTEGRATION_TOKEN` com seu Enterprise Token.
</Note>
```bash
export CREWAI_PLATFORM_INTEGRATION_TOKEN="seu_enterprise_token"
```
Ou adicione ao seu arquivo `.env`:
```
CREWAI_PLATFORM_INTEGRATION_TOKEN=seu_enterprise_token
```
## Ferramentas Disponíveis
### **Gerenciamento de Clientes**
<AccordionGroup>
<Accordion title="stripe/create_customer">
**Descrição:** Crie um novo cliente em sua conta Stripe.
**Parâmetros:**
- `emailCreateCustomer` (string, obrigatório): Endereço de e-mail do cliente
- `name` (string, opcional): Nome completo do cliente
- `description` (string, opcional): Descrição do cliente para referência interna
- `metadataCreateCustomer` (objeto, opcional): Metadados adicionais como pares chave-valor (exemplo: `{"field1": 1, "field2": 2}`)
</Accordion>
<Accordion title="stripe/get_customer_by_id">
**Descrição:** Recupera um cliente específico pelo ID do cliente Stripe.
**Parâmetros:**
- `idGetCustomer` (string, obrigatório): O ID do cliente Stripe a ser recuperado
</Accordion>
<Accordion title="stripe/get_customers">
**Descrição:** Recupera uma lista de clientes com filtragem opcional.
**Parâmetros:**
- `emailGetCustomers` (string, opcional): Filtra clientes pelo endereço de e-mail
- `createdAfter` (string, opcional): Filtra clientes criados após esta data (timestamp Unix)
- `createdBefore` (string, opcional): Filtra clientes criados antes desta data (timestamp Unix)
- `limitGetCustomers` (string, opcional): Número máximo de clientes a retornar (padrão: 10)
</Accordion>
<Accordion title="stripe/update_customer">
**Descrição:** Atualiza as informações de um cliente existente.
**Parâmetros:**
- `customerId` (string, obrigatório): O ID do cliente a ser atualizado
- `emailUpdateCustomer` (string, opcional): Novo endereço de e-mail
- `name` (string, opcional): Novo nome do cliente
- `description` (string, opcional): Nova descrição do cliente
- `metadataUpdateCustomer` (objeto, opcional): Novos metadados como pares chave-valor
</Accordion>
</AccordionGroup>
### **Gerenciamento de Assinaturas**
<AccordionGroup>
<Accordion title="stripe/create_subscription">
**Descrição:** Cria uma nova assinatura para um cliente.
**Parâmetros:**
- `customerIdCreateSubscription` (string, obrigatório): O ID do cliente para o qual a assinatura será criada
- `plan` (string, obrigatório): O ID do plano para assinatura - Use as Configurações do Workflow do Portal Connect para permitir que usuários selecionem um plano
- `metadataCreateSubscription` (objeto, opcional): Metadados adicionais para a assinatura
</Accordion>
<Accordion title="stripe/get_subscriptions">
**Descrição:** Recupera assinaturas com filtragem opcional.
**Parâmetros:**
- `customerIdGetSubscriptions` (string, opcional): Filtra assinaturas por ID do cliente
- `subscriptionStatus` (string, opcional): Filtra por status da assinatura - Opções: incomplete, incomplete_expired, trialing, active, past_due, canceled, unpaid
- `limitGetSubscriptions` (string, opcional): Número máximo de assinaturas a retornar (padrão: 10)
</Accordion>
</AccordionGroup>
### **Gerenciamento de Produtos**
<AccordionGroup>
<Accordion title="stripe/create_product">
**Descrição:** Cria um novo produto no seu catálogo Stripe.
**Parâmetros:**
- `productName` (string, obrigatório): Nome do produto
- `description` (string, opcional): Descrição do produto
- `metadataProduct` (objeto, opcional): Metadados adicionais do produto como pares chave-valor
</Accordion>
<Accordion title="stripe/get_product_by_id">
**Descrição:** Recupera um produto específico pelo ID do produto Stripe.
**Parâmetros:**
- `productId` (string, obrigatório): O ID do produto Stripe a ser recuperado
</Accordion>
<Accordion title="stripe/get_products">
**Descrição:** Recupera uma lista de produtos com filtragem opcional.
**Parâmetros:**
- `createdAfter` (string, opcional): Filtra produtos criados após esta data (timestamp Unix)
- `createdBefore` (string, opcional): Filtra produtos criados antes desta data (timestamp Unix)
- `limitGetProducts` (string, opcional): Número máximo de produtos a retornar (padrão: 10)
</Accordion>
</AccordionGroup>
### **Operações Financeiras**
<AccordionGroup>
<Accordion title="stripe/get_balance_transactions">
**Descrição:** Recupera transações de saldo da sua conta Stripe.
**Parâmetros:**
- `balanceTransactionType` (string, opcional): Filtra por tipo de transação - Opções: charge, refund, payment, payment_refund
- `paginationParameters` (objeto, opcional): Configurações de paginação
- `pageCursor` (string, opcional): Cursor da página para paginação
</Accordion>
<Accordion title="stripe/get_plans">
**Descrição:** Recupera planos de assinatura da sua conta Stripe.
**Parâmetros:**
- `isPlanActive` (boolean, opcional): Filtra por status do plano - true para planos ativos, false para inativos
- `paginationParameters` (objeto, opcional): Configurações de paginação
- `pageCursor` (string, opcional): Cursor da página para paginação
</Accordion>
</AccordionGroup>
## Exemplos de Uso
### Configuração Básica do Agente Stripe
```python
from crewai import Agent, Task, Crew
# Create an agent with Stripe capabilities
stripe_agent = Agent(
role="Payment Manager",
goal="Manage customer payments, subscriptions, and billing operations efficiently",
backstory="An AI assistant specialized in payment processing and subscription management.",
apps=['stripe']
)
# Task to create a new customer
create_customer_task = Task(
description="Create a new premium customer John Doe with email john.doe@example.com",
agent=stripe_agent,
expected_output="Customer created successfully with customer ID"
)
# Run the task
crew = Crew(
agents=[stripe_agent],
tasks=[create_customer_task]
)
crew.kickoff()
```
### Filtrando Ferramentas Stripe Específicas
```python
billing_manager = Agent(
role="Billing Manager",
goal="Handle customer billing, subscriptions, and payment processing",
backstory="An experienced billing manager who handles subscription lifecycle and payment operations.",
apps=['stripe']
)
# Task to manage billing operations
billing_task = Task(
description="Create a new customer and set up their premium subscription plan",
agent=billing_manager,
expected_output="Customer created and subscription activated successfully"
)
crew = Crew(
agents=[billing_manager],
tasks=[billing_task]
)
crew.kickoff()
```
### Gerenciamento de Assinaturas
```python
from crewai import Agent, Task, Crew
subscription_manager = Agent(
role="Subscription Manager",
goal="Manage customer subscriptions and optimize recurring revenue",
backstory="An AI assistant that specializes in subscription lifecycle management and customer retention.",
apps=['stripe']
)
# Task to manage subscription operations
subscription_task = Task(
description="""
1. Create a new product "Premium Service Plan" with advanced features
2. Set up subscription plans with different tiers
3. Create customers and assign them to appropriate plans
4. Monitor subscription status and handle billing issues
""",
agent=subscription_manager,
expected_output="Subscription management system configured with customers and active plans"
)
crew = Crew(
agents=[subscription_manager],
tasks=[subscription_task]
)
crew.kickoff()
```
### Análises e Relatórios Financeiros
```python
from crewai import Agent, Task, Crew
financial_analyst = Agent(
role="Financial Analyst",
goal="Analyze payment data and generate financial insights",
backstory="An analytical AI that excels at extracting insights from payment and subscription data.",
apps=['stripe']
)
# Complex task involving financial analysis
analytics_task = Task(
description="""
1. Retrieve balance transactions for the current month
2. Analyze customer payment patterns and subscription trends
3. Identify high-value customers and subscription performance
4. Generate monthly financial performance report
""",
agent=financial_analyst,
expected_output="Comprehensive financial analysis with payment insights and recommendations"
)
crew = Crew(
agents=[financial_analyst],
tasks=[analytics_task]
)
crew.kickoff()
```
## Referência de Status de Assinatura
Compreendendo os status de assinaturas:
- **incomplete** - A assinatura requer método de pagamento ou confirmação de pagamento
- **incomplete_expired** - A assinatura expirou antes da confirmação do pagamento
- **trialing** - A assinatura está em período de avaliação
- **active** - A assinatura está ativa e em dia
- **past_due** - O pagamento falhou mas a assinatura ainda está ativa
- **canceled** - A assinatura foi cancelada
- **unpaid** - O pagamento falhou e a assinatura não está mais ativa
## Uso de Metadados
Os metadados permitem que você armazene informações adicionais sobre clientes, assinaturas e produtos:
```json
{
"customer_segment": "enterprise",
"acquisition_source": "google_ads",
"lifetime_value": "high",
"custom_field_1": "value1"
}
```
Esta integração permite uma automação abrangente do gerenciamento de pagamentos e assinaturas, possibilitando que seus agentes de IA administrem operações de faturamento perfeitamente dentro do seu ecossistema Stripe.