API: Stripe Payment Synthetic Testing
Property: ChurchWiseAI Category: API / Integration
Tier:
all
Persona: payments-engineer
Touchpoint: /api/stripe/*, Stripe API
Preconditions
- Stripe test mode configured
- Test API keys available
Steps
| # | Action | Expected Result |
|---|---|---|
| 1 | Test successful payment (test card 4242 4242 4242 4242) | Payment succeeds. Stripe returns successful status. Webhook fired. |
| 2 | Test declined card (4000 0000 0000 0002) | Payment fails. Checkout shows error to user. No duplicate charges. |
| 3 | Verify webhook delivery on success | checkout.session.completed webhook received within 2 seconds. Processed correctly. |
| 4 | Test webhook retry (simulate missed webhook) | Resending webhook is processed correctly. No duplicate provisioning. |
| 5 | Test customer subscription creation | Stripe customer created. Initial payment charged. Subscription active. |
| 6 | Test subscription renewal | At renewal date, customer charged. New billing cycle starts. |
| 7 | Test customer cancellation | Subscription canceled. No further charges. Chatbot disabled. |
| 8 | Verify payment amounts match pricing | Starter Chat $14.95, Pro Both $79.95 in test payments. No mismatches. |
Known Failure Modes
- Successful payment doesn't trigger webhook — business logic skipped
- Webhook processed twice — duplicate provisioning
- Wrong amount charged — billing error
- Subscription renewal fails silently — customer churn
References
- Playwright spec:
e2e (Stripe validation) - Code files:
Notes
Synthetic payment testing using Stripe test cards. Tests both success and failure paths. Critical for catching revenue leaks (missed webhooks, duplicate charges, wrong amounts). Run before each release that touches checkout or subscription logic. Must verify webhook delivery and idempotency.