Testing Documentation
Security Deposit Testing Documentation
Comprehensive testing guide for two-part transaction security deposit system
System Architecture
Understanding the two-part transaction flow
Transaction Flow:
- Guest Booking: Guest selects vehicle, dates, and payment method
- Card Tokenization: Xendit.js tokenizes card on client-side (PCI-compliant)
- Charge (Part 1): Immediate charge for rental amount (base + extras)
- Pre-Authorization (Part 2): Security deposit hold (7-day validity)
- Booking Confirmation: Both transactions succeed → booking confirmed
- Return & Release: Host accepts return → deposit automatically released
- Damage Capture (if needed): Admin captures partial/full deposit for damages
Key Concept: The rental charge is immediate and final, while the security deposit is only a hold that can be released or captured later.
Test Environment Setup
# Environment Variables Required:
XENDIT_SECRET_KEY=xnd_xxx (Test Mode)
XENDIT_PUBLIC_KEY=xnd_public_xxx
XENDIT_WEBHOOK_VERIFICATION_ID_TEST=your_webhook_token
⚠️ Xendit Test Cards:
| Card Number | Scenario | Result |
|---|---|---|
| 4000000000000002 | Success | Approved |
| 4000000000000044 | Insufficient Funds | Declined |
| 4000000000000101 | Generic Failure | Failed |
Use any future expiry date (e.g., 12/25) and any 3-digit CVV
