Testing
Test mode is available in all Omise accounts by default and works across all API versions and payment methods. Use test API keys to simulate transactions without processing real payments.
Test API Keysโ
Test keys are identified by the test prefix:
| Key Type | Format | Usage |
|---|---|---|
| Public Key | pkey_test_... | Client-side (Omise.js) |
| Secret Key | skey_test_... | Server-side API calls |
Get your test keys from Dashboard โ Settings โ API Keys while in test mode.
Test Cardsโ
Successful Chargesโ
| Card Number | Brand |
|---|---|
| 4242 4242 4242 4242 | Visa |
| 4111 1111 1111 1111 | Visa |
| 5555 5555 5555 4444 | Mastercard |
| 5454 5454 5454 5454 | Mastercard |
| 3530 1113 3330 0000 | JCB |
| 3566 1111 1111 1113 | JCB |
| 3782 8224 6310 005 | Amex |
| 6447 0324 0000 0000 001 | Discover |
| 3602 1042 0000 04 | Diners |
| 6250 9470 0000 0006 | UnionPay |
All test card numbers work with any expiration date and security code in test mode.
Failed Chargesโ
| Card Number | Failure Code |
|---|---|
| 4111 1111 1114 0011 | insufficient_fund |
| 4111 1111 1113 0012 | stolen_or_lost_card |
| 4111 1111 1112 0013 | failed_processing |
| 4111 1111 1111 0014 | payment_rejected |
| 4111 1111 1119 0016 | failed_fraud_check |
| 4111 1111 1118 0017 | invalid_account_number |
3D Secure Testingโ
3DS requires account enablement. Contact support@omise.co to enable.
| Card Number | 3DS Behavior |
|---|---|
| 4242 4242 4242 4242 | Frictionless (no challenge) |
| 4111 1111 1115 0002 | Enrollment failure |
| 4111 1111 1114 0003 | Authentication failure |
Testing Alternative Payment Methodsโ
For Internet Banking, QR payments, e-wallets, and other redirect-based methods:
- Create a source and charge in test mode
- Navigate to Dashboard โ Charges
- Find the pending charge
- Click the Actions button
- Select Mark as Successful or Mark as Failed
This simulates the customer completing or abandoning the payment.
Testing Webhooksโ
Configure webhook endpoints in your dashboard under Settings โ Webhooks.
Key points for webhook testing:
- Use HTTPS endpoints with valid SSL certificates
- Return HTTP 200 status to acknowledge receipt
- Implement signature verification for security
- Use tools like ngrok for local development testing
# Test webhook delivery locally with ngrok
ngrok http 3000
# Configure the ngrok URL in your dashboard webhooks
Example Test Chargeโ
curl https://api.omise.co/charges \
-u $OMISE_SECRET_KEY: \
-d "amount=100000" \
-d "currency=THB" \
-d "card=tokn_test_..."
Going Live Checklistโ
Before switching to live mode:
- Test successful payments with test cards
- Test declined payments and error handling
- Verify webhook delivery and processing
- Test refund flows
- Configure live API keys
- Update endpoints to use live keys
FAQโ
Can I use test mode for integration development?
Yes, test mode is recommended for all development and integration work. Test transactions don't process real payments, and you can safely experiment with all API features without any financial risk.
Do test cards work with all payment features?
Test cards support most card payment features including 3D Secure, refunds, and disputes. However, some features like actual bank responses require live mode. Check each feature's documentation for test mode limitations.
How do I simulate specific failure scenarios?
Use the failure test cards provided above. Each card number triggers a specific error code (insufficient funds, stolen card, etc.). This allows you to test your error handling without processing real transactions.
Are webhooks sent in test mode?
Yes, webhooks are sent for test mode events just like in live mode. Configure your webhook endpoint in the dashboard and use tools like ngrok for local testing.
How long do test transactions stay in my account?
Test transactions remain in your account indefinitely. You can view them in your dashboard under test mode. They don't affect your live transaction history or reporting.
Can I test 3D Secure without enabling it on my account?
No, 3D Secure must be enabled on your account before you can test it. Contact support@omise.co to enable 3D Secure for your account, then use the 3DS test cards provided above.