Skip to main content

Testing Stripe Integration

Learn how to safely test your Stripe integration without processing real payments.

Test Mode Setup

Before testing with real money, use Stripe’s test environment:
  1. In ChatCrafterAI integration settings, select Test Mode
  2. Use test API keys from your Stripe dashboard (they start with pk_test_ and sk_test_)
  3. Enter test keys in ChatCrafterAI Stripe integration
  4. Verify connection shows “Test Mode” status

Test Card Numbers

Stripe provides test card numbers for different scenarios. Use these in your agent tests:

Successful Payment

  • Card number: 4242 4242 4242 4242
  • Result: Payment succeeds

Declined Payment

  • Card number: 4000 0000 0000 0002
  • Result: Card declined

Requires Authentication

  • Card number: 4000 0025 0000 3155
  • Result: Requires 3D Secure authentication

Expired Card

  • Card number: 4000 0000 0000 0069
  • Result: Card expired error

Insufficient Funds

  • Card number: 4000 0000 0000 9995
  • Result: Insufficient funds error
For all test cards:
  • Use any future expiration date (e.g., 12/25)
  • Use any 3-digit CVC
  • Use any postal code

Testing Workflow

Basic Payment Test

  1. Set agent to Test Mode in integration settings
  2. Open Chatlab (ChatCrafterAI testing environment)
  3. Send message: “I want to pay my invoice”
  4. Agent initiates payment flow
  5. Use test card 4242 4242 4242 4242
  6. Complete payment process
  7. Check Stripe Test Dashboard for transaction
  8. Verify agent receives success webhook
  9. Confirm agent sends confirmation message

Testing Different Scenarios

Successful Transaction:
  1. Use card 4242 4242 4242 4242
  2. Complete payment
  3. Verify transaction appears in Stripe test dashboard
  4. Confirm agent shows success message
Failed Payment:
  1. Use declined card 4000 0000 0000 0002
  2. Attempt payment
  3. Verify agent displays appropriate error message
  4. Check no charge appears in Stripe
Customer Lookup:
  1. Create test customer in Stripe test dashboard
  2. Ask agent: “What’s my balance?”
  3. Verify agent returns correct customer data
Refund Processing:
  1. Complete successful test payment
  2. Request refund through agent
  3. Verify refund appears in Stripe test dashboard
  4. Confirm agent shows refund confirmation

What to Test

Essential test cases for your integration:
  • Payment flow - Complete transaction from start to finish
  • Failed payments - Handle declined cards gracefully
  • Customer lookup - Find customers by email/ID
  • Balance check - Display correct amounts
  • Invoice creation - Generate and send invoices
  • Refunds - Process full and partial refunds
  • Subscriptions - Create, update, cancel
  • Error messages - All errors display clearly
  • Webhook handling - Agent receives and processes events

Common Test Scenarios

User Cancels Mid-Flow

  1. Start payment process
  2. User sends “cancel” or navigates away
  3. Verify payment intent is cancelled
  4. Confirm no charge occurs

Invalid Customer ID

  1. Agent attempts lookup with wrong ID
  2. Verify graceful error handling
  3. Check agent asks for correct information

Network Disconnection

  1. Simulate by temporarily disconnecting integration
  2. Attempt payment
  3. Verify agent shows connectivity error
  4. Reconnect and retry successfully

Duplicate Payment Prevention

  1. Attempt same payment twice quickly
  2. Verify idempotency key prevents duplicate
  3. Confirm only one charge appears

Switching to Production

When you’re confident everything works:
  1. Verify all tests pass in test mode
  2. Get production API keys from Stripe dashboard (start with pk_live_ and sk_live_)
  3. Update ChatCrafterAI integration with production keys
  4. Change mode to Production in settings
  5. Test with small amount - Process one real transaction with minimal amount
  6. Monitor Stripe dashboard for first few real transactions
  7. Full deployment when confident everything works

Test Checklist

Before going live:
  • Successful payment completes end-to-end
  • Failed payments show appropriate errors
  • Customer lookup works correctly
  • Balance displays accurate amounts
  • Invoices generate and send properly
  • Refunds process successfully
  • Webhooks trigger agent actions
  • All error messages are user-friendly
  • Test mode transactions appear in Stripe test dashboard
  • No test charges in production Stripe

Next Steps

Encountering issues? Check the Troubleshooting Guide.