> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chatcrafterai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Actions

# Stripe Actions Reference

Complete reference of actions your ChatCrafterAI agent can perform with Stripe integration.

## Payment Actions

### Create Payment Intent

Initiate a charge for a customer.

**Required parameters:**

* Amount (in cents, e.g., 2500 for \$25.00)
* Currency (e.g., "usd")
* Description (what the payment is for)

**Optional parameters:**

* Customer ID
* Metadata (custom tracking fields)
* Idempotency key (prevents duplicate charges)

### Process Payment

Complete a payment transaction.

**Required:** Customer card on file

**Returns:** Transaction ID, status, amount charged

### Get Customer Balance

Retrieve current balance owed by customer.

**Required:** Customer ID or email

**Returns:** Current balance amount

## Invoice Actions

### Create Invoice

Generate a new invoice for a customer.

**Required parameters:**

* Customer ID
* Line items (description, amount)

**Optional:** Due date, metadata

### Send Invoice

Email invoice to customer and track in Stripe.

**Required:** Invoice ID

**Returns:** Delivery status

### List Invoices

View customer's invoice history.

**Required:** Customer ID or email

**Returns:** Array of invoices with status and amounts

### Check Invoice Status

Get current status of specific invoice.

**Required:** Invoice ID

**Returns:** Status (paid, draft, overdue, void)

## Customer Actions

### Get Customer Info

Retrieve customer details.

**Required:** Customer ID or email

**Returns:** Name, email, balance, default payment method, metadata

### Look Up by Email

Find customer using email address.

**Required:** Email address

**Returns:** Customer object with all details

### Update Customer

Modify customer information.

**Required:** Customer ID

**Can update:** Email, metadata, default payment method, description

## Subscription Actions

### Create Subscription

Start a recurring subscription for customer.

**Required parameters:**

* Customer ID
* Price ID (Stripe product price)

**Optional:** Trial period, billing cycle anchor, metadata

### Cancel Subscription

End a recurring subscription.

**Required:** Subscription ID

**Options:** Cancel immediately or at period end

### Update Subscription

Modify existing subscription.

**Can change:** Price/plan, pause/resume, billing cycle, metadata

### List Subscriptions

Show all active subscriptions for customer.

**Required:** Customer ID

**Returns:** Array of subscriptions with status and details

## Refund Actions

### Issue Full Refund

Refund entire charge amount.

**Required:** Charge ID

**Returns:** Refund ID, status, amount

### Issue Partial Refund

Refund portion of original charge.

**Required:** Charge ID, amount to refund

**Returns:** Refund ID, status, remaining balance

### Check Refund Status

Track refund progress.

**Required:** Refund ID

**Returns:** Status (succeeded, pending, failed)

## Webhook Actions

Your agent automatically receives and processes these Stripe events:

* **payment\_intent.succeeded** - Payment completed successfully
* **customer.subscription.updated** - Subscription changed
* **invoice.payment\_succeeded** - Invoice paid
* **charge.refunded** - Refund processed

Webhooks can trigger agent actions when events occur, enabling automated responses.

## Common Action Patterns

**Payment Flow:**

1. User asks to pay invoice
2. Agent creates payment intent
3. Agent returns secure payment link
4. Customer completes payment
5. Webhook confirms to agent
6. Agent sends confirmation message

**Balance Check:**

1. User asks about balance
2. Agent looks up customer by email
3. Agent retrieves balance
4. Agent displays: "Your balance is \$250"

**Subscription Management:**

1. User requests upgrade
2. Agent shows available plans
3. User selects plan
4. Agent creates/updates subscription
5. Agent confirms: "Your subscription is active"

## Action Response Data

All actions return structured data including:

* **Transaction ID** - Unique identifier
* **Status** - Current state (succeeded, processing, failed)
* **Amount** - Money involved (in cents)
* **Customer details** - Name, email, ID
* **Timestamp** - When action occurred
* **Error messages** - If action failed

## Safety Features

* **Test mode** - Practice without real charges
* **Amount verification** - Confirms amounts before processing
* **Idempotency keys** - Prevents accidental duplicate charges
* **Webhook signing** - Ensures events are authentic from Stripe
* **Automatic retries** - Handles temporary network issues

## Next Steps

See real-world implementations in the [Examples Guide](./examples).
