> ## 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.

# Examples

# Stripe Integration Examples

Real-world examples of how your agent can handle payment scenarios with Stripe.

## Example 1: Payment Processing Agent

**Customer:** "I want to pay my invoice"

**Agent:** "You have an outstanding invoice #1234 for \$150. Would you like to pay now?"

**Customer:** Clicks "Yes, pay now" button

**Agent:** Creates payment intent in Stripe

**Agent:** "Please complete your payment here: \[secure payment link]"

**Customer:** Completes payment via Stripe checkout

**Agent:** Receives webhook confirmation

**Agent:** "Payment received! Your invoice #1234 is now paid. Transaction ID: ch\_abc123"

## Example 2: Balance Check Agent

**Customer:** "What do I owe?"

**Agent:** Looks up customer by email from conversation

**Agent:** Calls Stripe Get Customer Balance action

**Agent:** "Your current account balance is \$250. You have 2 unpaid invoices."

**Customer:** "Show me the invoices"

**Agent:** Lists invoices with amounts and due dates

## Example 3: Subscription Management

**Customer:** "I want to upgrade my plan"

**Agent:** "You're currently on the Basic plan (\$10/month). Available upgrades:"

* Pro plan - \$25/month
* Enterprise plan - \$50/month

**Customer:** Selects "Pro plan"

**Agent:** Creates subscription in Stripe

**Agent:** Updates customer's subscription

**Agent:** "Your subscription is now upgraded to Pro! Your next billing date is March 1st. You'll be charged \$25 monthly."

## Example 4: Invoice Generation

**Customer:** "Create an invoice for the consulting work"

**Agent:** "I'll create an invoice for you. What should I include?"

**Customer:** "5 hours at \$100/hour"

**Agent:** Captures details

**Agent:** Creates invoice in Stripe with line items

**Agent:** Sends invoice via Stripe

**Agent:** "Invoice #5678 created and sent to your email ([john@example.com](mailto:john@example.com)). Total: \$500. Due: February 15th."

## Example 5: Refund Request

**Customer:** "I need a refund for order #9876"

**Agent:** "Let me look up your order"

**Agent:** Retrieves charge details from Stripe

**Agent:** "Order #9876 was \$75 charged on January 10th. Confirming refund policy..."

**Agent:** Checks refund eligibility (within 30 days, etc.)

**Agent:** "Refund approved. Processing \$75 refund now\..."

**Agent:** Issues refund via Stripe API

**Agent:** "Refund processed successfully! You'll see \$75 back in your account within 3-5 business days. Refund ID: re\_xyz789"

## Example 6: Subscription Cancellation

**Customer:** "I need to cancel my subscription"

**Agent:** "I can help you cancel. You're currently on the Pro plan (\$25/month, renews March 1st)."

**Agent:** "Would you like to:"

* Cancel immediately (no refund)
* Cancel at end of billing period (access until March 1st)

**Customer:** Selects "Cancel at end of period"

**Agent:** Cancels subscription in Stripe with at\_period\_end flag

**Agent:** "Your subscription is cancelled. You'll maintain access until March 1st, and won't be charged again. We're sorry to see you go!"

## Example 7: Failed Payment Recovery

**Agent:** Receives webhook: payment\_intent.failed

**Agent:** Automatically messages customer: "Your payment of \$50 for invoice #4321 was declined. Please update your payment method."

**Customer:** "What happened?"

**Agent:** "The card ending in 4242 was declined. Would you like to try a different card?"

**Customer:** Updates card details

**Agent:** Retries payment with new card

**Agent:** "Payment successful! Invoice #4321 is now paid."

## Example 8: Automated Subscription Renewal

**Webhook received:** customer.subscription.updated (renewal)

**Agent:** Automatically sends message: "Your Pro subscription has renewed for another month. \$25 charged to card ending in 1234. Thank you!"

**Customer:** Can view receipt or ask questions immediately

## Next Steps

Learn how to test these scenarios safely with the [Testing Guide](./testing).
