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:- In ChatCrafterAI integration settings, select Test Mode
- Use test API keys from your Stripe dashboard (they start with
pk_test_andsk_test_) - Enter test keys in ChatCrafterAI Stripe integration
- 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
- Use any future expiration date (e.g., 12/25)
- Use any 3-digit CVC
- Use any postal code
Testing Workflow
Basic Payment Test
- Set agent to Test Mode in integration settings
- Open Chatlab (ChatCrafterAI testing environment)
- Send message: “I want to pay my invoice”
- Agent initiates payment flow
- Use test card 4242 4242 4242 4242
- Complete payment process
- Check Stripe Test Dashboard for transaction
- Verify agent receives success webhook
- Confirm agent sends confirmation message
Testing Different Scenarios
Successful Transaction:- Use card 4242 4242 4242 4242
- Complete payment
- Verify transaction appears in Stripe test dashboard
- Confirm agent shows success message
- Use declined card 4000 0000 0000 0002
- Attempt payment
- Verify agent displays appropriate error message
- Check no charge appears in Stripe
- Create test customer in Stripe test dashboard
- Ask agent: “What’s my balance?”
- Verify agent returns correct customer data
- Complete successful test payment
- Request refund through agent
- Verify refund appears in Stripe test dashboard
- 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
- Start payment process
- User sends “cancel” or navigates away
- Verify payment intent is cancelled
- Confirm no charge occurs
Invalid Customer ID
- Agent attempts lookup with wrong ID
- Verify graceful error handling
- Check agent asks for correct information
Network Disconnection
- Simulate by temporarily disconnecting integration
- Attempt payment
- Verify agent shows connectivity error
- Reconnect and retry successfully
Duplicate Payment Prevention
- Attempt same payment twice quickly
- Verify idempotency key prevents duplicate
- Confirm only one charge appears
Switching to Production
When you’re confident everything works:- Verify all tests pass in test mode
- Get production API keys from Stripe dashboard (start with
pk_live_andsk_live_) - Update ChatCrafterAI integration with production keys
- Change mode to Production in settings
- Test with small amount - Process one real transaction with minimal amount
- Monitor Stripe dashboard for first few real transactions
- 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