Test vs Live Mode
Omise provides a complete test environment where you can develop and test your integration without processing real transactions or using real money.
Two Separate Environmentsโ
Omise operates two completely isolated environments:
Test Mode (Sandbox)โ
- โ Free to use - no charges or fees
- โ Fully functional - test all features and payment methods
- โ No real money - simulated transactions only
- โ No verification required - instant access after signup
- โ Test cards - use special card numbers to simulate different scenarios
- โ Separate dashboard - Test Dashboard at dashboard.omise.co
Live Mode (Production)โ
- ๐ฐ Real transactions - actual money is processed
- ๐ฐ Real cards - customers use their actual payment methods
- ๐ฐ Fees apply - standard transaction fees apply
- ๐ฐ Verification required - business verification needed
- ๐ฐ Separate dashboard - Live Dashboard at dashboard.omise.co
Test and live modes are completely separate. Test data never affects live data, and test charges never process real money.
Switching Between Modesโ
The only difference between test and live mode is which API keys you use:
| Mode | Public Key | Secret Key |
|---|---|---|
| Test | pkey_test_... | skey_test_... |
| Live | pkey_... | skey_... |
Your integration code stays exactly the same. Just swap the API keys when you're ready to go live!
Code Exampleโ
// Development/Testing
const omise = require('omise')({
secretKey: 'skey_test_5xp6c8n0jvds5mmjizz' // Test key
});
// Production
const omise = require('omise')({
secretKey: 'skey_5xp6c8n0jvds5mmjizz' // Live key (no "_test_")
});
Test Dashboard Featuresโ
When using test mode, you have access to special testing features:
1. Automatic Transfersโ
In test mode, transferred funds automatically appear in your "Transferable" balance:
- Test Mode: Instant, no waiting period
- Live Mode: 7 days (Thailand), 21 days (Japan)
2. Manual Status Controlโ
For certain payment methods, you can manually mark charges as successful or failed:
- Navigate to the charge in your dashboard
- Click Actions
- Select Mark as Successful or Mark as Failed
This is useful for testing alternative payment methods like bank transfers and QR payments.
3. Webhook Testingโ
Test webhooks fire just like live webhooks, but with test data:
- Delivered to your configured webhook endpoint
- Include test mode data
- Help you develop webhook handlers before going live
4. Transfer Simulationโ
Test the complete transfer flow:
- Create charges
- Wait for funds to become transferable (instant in test)
- Create transfers
- Use Mark as sent and Mark as paid to simulate bank processing
Test Cardsโ
Use these special card numbers in test mode to simulate different scenarios:
Successful Paymentsโ
| Card Number | Brand | 3DS |
|---|---|---|
4242 4242 4242 4242 | Visa | No |
5555 5555 5555 4444 | Mastercard | No |
3530 1113 3330 0000 | JCB | No |
3782 822463 10005 | American Express | No |
3600 666633 3344 | Diners Club | No |
6011 1111 1111 1117 | Discover | No |
In test mode, use any future expiration date and any 3-4 digit CVV code. The specific values don't matter.
Failed Paymentsโ
Test specific error scenarios with these cards:
| Card Number | Error Code | Error Message |
|---|---|---|
4000 0000 0000 0002 | insufficient_fund | Insufficient funds |
4000 0000 0000 0069 | stolen_or_lost_card | Card reported stolen |
4000 0000 0000 0101 | failed_processing | Payment processing failed |
4000 0000 0000 0119 | payment_rejected | Payment rejected by issuer |
4000 0000 0000 0127 | failed_fraud_check | Failed fraud check |
4000 0000 0000 0010 | invalid_account_number | Invalid card number |
Example:
curl https://vault.omise.co/tokens \
-X POST \
-u pkey_test_YOUR_KEY: \
-d "card[number]=4000000000000002" \
-d "card[name]=John Doe" \
-d "card[expiration_month]=12" \
-d "card[expiration_year]=2027" \
-d "card[security_code]=123"
# This will create a charge that fails with "insufficient_fund"
3D Secure Testingโ
To test 3D Secure (3DS) authentication:
- Enable 3DS on your test account (contact support@omise.co)
- Use 3DS test cards (see table below)
- You'll see a mock authentication page
- Choose Complete or Fail to test different outcomes
3D Secure Test Cardsโ
3DS testing requires a 3DS-enabled test account. Contact support@omise.co to enable 3D Secure for your test account.
Enrollment Failure Cards (setup issues):
| Card Number | Brand | Result |
|---|---|---|
4111 1111 1115 0002 | Visa | 3DS enrollment fails |
5555 5511 1112 0002 | Mastercard | 3DS enrollment fails |
3530 1111 1110 0002 | JCB | 3DS enrollment fails |
Authentication Failure Cards (validation issues):
| Card Number | Brand | Result |
|---|---|---|
4111 1111 1114 0003 | Visa | 3DS authentication fails |
5555 5511 1111 0003 | Mastercard | 3DS authentication fails |
3771 3816 1111 003 | Amex | 3DS authentication fails |
Testing Flow:
# 1. Create token with 3DS card
curl https://api.omise.co/tokens \
-u pkey_test_YOUR_PUBLIC_KEY: \
-d "card[name]=John Doe" \
-d "card[number]=4111111111150002" \
-d "card[expiration_month]=12" \
-d "card[expiration_year]=2027" \
-d "card[security_code]=123"
# 2. Create charge with return_uri for 3DS redirect
curl https://api.omise.co/charges \
-u skey_test_YOUR_SECRET_KEY: \
-d "amount=100000" \
-d "currency=thb" \
-d "card=TOKEN_ID" \
-d "return_uri=https://example.com/3ds-return"
# 3. Charge status will be "pending" with authorize_uri
# 4. Redirect customer to authorize_uri for authentication
# 5. Customer completes 3DS challenge
# 6. Charge status changes to "successful" or "failed"
Learn more about 3D Secure โ
Testing Payment Methodsโ
Credit/Debit Cardsโ
Use the test card numbers above with your public key to create tokens:
Omise.setPublicKey('pkey_test_YOUR_KEY');
Omise.createToken('card', {
name: 'John Doe',
number: '4242424242424242', // Test card
expiration_month: 12,
expiration_year: 2027,
security_code: '123'
}, callback);
Alternative Payment Methodsโ
For alternative payment methods (PromptPay, TrueMoney, mobile banking, etc.):
- Create a source/charge using test keys
- In test mode, you'll see a simulated payment page
- Complete or cancel the payment to test different scenarios
- Or use Mark as Successful/Failed in the dashboard
Example - PromptPay:
curl https://api.omise.co/sources \
-X POST \
-u skey_test_YOUR_KEY: \
-d "type=promptpay" \
-d "amount=100000" \
-d "currency=THB"
# Returns a test QR code and payment page
Testing Webhooksโ
Setting Up Test Webhooksโ
- Go to Test Dashboard โ Settings โ Webhooks
- Add your webhook endpoint URL
- Select events to receive
- Save configuration
Requirements for Test Webhooksโ
- โ
Publicly accessible URL (not
localhost) - โ HTTPS with valid SSL certificate
- โ Returns 200 status code
- โ Responds within 10 seconds
Use tools like ngrok or localtunnel to expose your local development server for webhook testing.
Testing Webhook Deliveryโ
- Trigger an event (create a charge, refund, etc.)
- Check your webhook endpoint logs
- Verify in dashboard: Settings โ Webhooks โ Delivery Logs
Example Webhook Payload (Test Mode):
{
"object": "event",
"id": "evnt_test_5xp6ch5pmx5c5zzfjc3",
"livemode": false,
"location": "/events/evnt_test_5xp6ch5pmx5c5zzfjc3",
"key": "charge.complete",
"created_at": "2024-01-15T08:00:00Z",
"data": {
"object": "charge",
"id": "chrg_test_5xp6ccfmecft4zxrb7p",
"livemode": false,
"status": "successful",
"amount": 100000,
"currency": "thb"
}
}
Note the "livemode": false field indicating test mode.
Testing Checklistโ
Before going live, test these scenarios:
Basic Functionalityโ
- Create successful charges with test cards
- Handle failed charges (declined cards)
- Process refunds (full and partial)
- Save cards to customers
- Charge saved cards
Error Handlingโ
- Network timeouts
- Invalid card numbers
- Declined payments
- Insufficient funds
- API errors (invalid parameters)
Payment Methodsโ
- All payment methods you plan to support
- Regional payment methods for your market
- Both successful and failed scenarios
Webhooksโ
- Webhook delivery and parsing
- Retry logic for failed deliveries
- Signature verification
- All event types you handle
3D Secure (if enabled)โ
- 3DS enrollment check
- Successful authentication
- Failed authentication
- User abandonment
User Experienceโ
- Payment form usability
- Mobile responsiveness
- Error message display
- Success confirmation
- Email notifications
Securityโ
- API keys stored securely
- HTTPS enabled
- No sensitive data in logs
- Card data never touches your server
View Complete Testing Guide โ
Differences Between Test and Liveโ
| Feature | Test Mode | Live Mode |
|---|---|---|
| Transactions | Simulated | Real |
| Money | Fake | Real |
| Cards | Test cards only | Real cards only |
| Fees | No fees | Standard fees apply |
| Verification | Not required | Business verification required |
| Transfer Schedule | Instant | 7-21 days hold period |
| Dashboard | Test Dashboard | Live Dashboard |
| API Keys | _test_ prefix | No _test_ prefix |
| Webhooks | Same as live | Same as test |
Common Issuesโ
Test Cards Don't Work in Live Modeโ
Problem: Test card numbers are declined in live mode.
Solution: Test cards only work with test keys. Use real cards in live mode (start with small amounts for testing).
Real Cards Don't Work in Test Modeโ
Problem: Real card numbers are declined in test mode.
Solution: Test mode only accepts the special test card numbers. Never test with real cards in test mode.
Webhooks Not Delivering Locallyโ
Problem: Webhooks don't reach your local development server.
Solution: Use a tunnel service like ngrok:
# Start ngrok
ngrok http 3000
# Use the HTTPS URL in your webhook settings
https://abc123.ngrok.io/webhooks
Missing Test Dataโ
Problem: Can't find test charges or data in live dashboard.
Solution: Test and live environments are completely separate. View test data in the Test Dashboard tab, not the Live Dashboard.
FAQโ
Can I use test keys in production?
No, test keys will not work with real payment methods. Attempting to use test keys in production will result in authentication errors. Always use live keys for production.
Do I need to delete test data before going live?
No need! Test and live environments are completely separate. Test data remains in the test environment and doesn't affect your live account in any way.
How do I test without a public webhook endpoint?
Options:
- Use ngrok or similar tools to expose your local server
- Deploy to a staging environment with a public URL
- Use webhook testing tools like webhook.site to inspect payloads
- Manually trigger events and check delivery logs in the dashboard
Can customers accidentally pay with test keys?
No, test keys only work with test payment methods. Real customers can't complete payments using test keys, which protects against accidental use in production.
How long can I use test mode?
Forever! There's no time limit on test mode. Use it for:
- Development and testing
- Training new developers
- Testing new features before deploying
- Demonstrating your integration
Are there rate limits in test mode?
Yes, the same rate limits apply in test mode as in live mode. This lets you test how your application handles rate limiting.
[Learn about rate limits โ](/api-reference/rate-limiting
Going Liveโ
Once you've thoroughly tested your integration:
- Complete business verification - Submit required documents
- Get live API keys - Available in Live Dashboard after verification
- Update your code - Replace test keys with live keys
- Test with real cards - Make small test purchases first
- Monitor closely - Watch your dashboard and webhook logs
- Scale up gradually - Start with low volumes and increase
Ready to test? Get your test API keys and start building!
Questions? Check our complete testing guide or contact support@omise.co.