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 NumberBrandResultUse Case
4242 4242 4242 4242VisaSuccessStandard success
5555 5555 5555 4444MastercardSuccessStandard success
3782 822463 10005AmexSuccessStandard success
4000 0000 0000 0002VisaDeclinedGeneric decline
4000 0000 0000 9995VisaDeclinedInsufficient funds
4000 0000 0000 0069VisaDeclinedExpired card
4000 0000 0000 0127VisaDeclinedIncorrect 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.

254712345678

Test Shortcode

The payment will appear from this shortcode.

174379

Test 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 Playground

Testing 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