Testing
Testing Guide
Test your integration using our sandbox environment before going live.
Sandbox Environment
The sandbox environment mirrors production exactly but doesn't process real payments. Use test API keys (prefixed with pk_test_) to access sandbox.
Test API Key Prefix
pk_test_*Live API Key Prefix
pk_live_*Test Card Numbers
Use these test card numbers in sandbox mode. Use any future expiry date and any 3-digit CVV.
| Card Number | Brand | Result | Use Case |
|---|---|---|---|
| 4242 4242 4242 4242 | Visa | Success | Standard success |
| 5555 5555 5555 4444 | Mastercard | Success | Standard success |
| 3782 822463 10005 | Amex | Success | Standard success |
| 4000 0000 0000 0002 | Visa | Declined | Generic decline |
| 4000 0000 0000 9995 | Visa | Declined | Insufficient funds |
| 4000 0000 0000 0069 | Visa | Declined | Expired card |
| 4000 0000 0000 0127 | Visa | Declined | Incorrect CVV |
M-PESA Sandbox
Live Environment
M-PESA testing uses the live Safaricom API. STK Push prompts are sent to real phone numbers. Simply cancel the prompt on your phone if you don't want to complete the payment.
Test Phone Number
Use any valid Kenyan M-PESA registered number for testing.
254712345678Test Shortcode
The payment will appear from this shortcode.
174379Test Scenarios
Successful paymentEnter correct M-PESA PIN
User cancelledDecline or cancel the STK prompt
TimeoutDon't respond to the STK prompt for 60 seconds
Wrong PINEnter incorrect PIN (multiple times will lock)
Interactive API Playground
Test API calls directly in your browser without writing any code.
Open PlaygroundTesting Webhooks
Use these tools to test your webhook implementation during development:
Ready to Go Live?
Before switching to production, make sure you have:
- Tested all payment flows in sandbox
- Implemented webhook signature verification
- Set up error handling for failed payments
- Configured proper callback URLs for production
- Switched from test API keys to live API keys