Skip to main content
Version: 2019-05-29 (Current)

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 TypeFormatUsage
Public Keypkey_test_...Client-side (Omise.js)
Secret Keyskey_test_...Server-side API calls

Get your test keys from Dashboard โ†’ Settings โ†’ API Keys while in test mode.

Test Cardsโ€‹

Successful Chargesโ€‹

Card NumberBrand
4242 4242 4242 4242Visa
4111 1111 1111 1111Visa
5555 5555 5555 4444Mastercard
5454 5454 5454 5454Mastercard
3530 1113 3330 0000JCB
3566 1111 1111 1113JCB
3782 8224 6310 005Amex
6447 0324 0000 0000 001Discover
3602 1042 0000 04Diners
6250 9470 0000 0006UnionPay

All test card numbers work with any expiration date and security code in test mode.

Failed Chargesโ€‹

Card NumberFailure Code
4111 1111 1114 0011insufficient_fund
4111 1111 1113 0012stolen_or_lost_card
4111 1111 1112 0013failed_processing
4111 1111 1111 0014payment_rejected
4111 1111 1119 0016failed_fraud_check
4111 1111 1118 0017invalid_account_number

3D Secure Testingโ€‹

3DS requires account enablement. Contact support@omise.co to enable.

Card Number3DS Behavior
4242 4242 4242 4242Frictionless (no challenge)
4111 1111 1115 0002Enrollment failure
4111 1111 1114 0003Authentication failure

Testing Alternative Payment Methodsโ€‹

For Internet Banking, QR payments, e-wallets, and other redirect-based methods:

  1. Create a source and charge in test mode
  2. Navigate to Dashboard โ†’ Charges
  3. Find the pending charge
  4. Click the Actions button
  5. 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.