MockGateway vs Real Payment Sandboxes
Use MockGateway when tests need to be fast, deterministic, and easy to run before credentials exist. Use the real provider sandbox when you need final proof that the provider account and production-shaped settings work.
Which one should you use?
A mock payment gateway and a real provider sandbox answer different questions. MockGateway is for repeatable application testing: does your code handle success, decline, timeout, redirect, webhook delivery results correctly? A provider sandbox is for provider validation: do your real credentials, account settings, and provider-specific flows work before launch?
Decision table
| Question | MockGateway | Real provider sandbox |
|---|---|---|
| Setup time | Under a minute for a hosted mock endpoint | Account, app, credentials, dashboard setup, and provider-specific configuration |
| Credentials | None for the demo flow; saved gateways use MockGateway keys | Provider sandbox keys and account access required |
| Failure injection | Select built-in outcomes and inspect webhook delivery results | Limited to the provider scenarios and test values that exist |
| Webhook delivery | One webhook delivery per test event | Depends on the provider dashboard and webhook tooling |
| CI suitability | Deterministic and stable across runs | Useful for scheduled checks, but can be flaky or rate-limited |
| Cost | Free tier for routine testing | Usually free, but setup and maintenance cost engineering time |
When MockGateway is the better first step
- You need a payment endpoint before credentials exist.
- You want automated tests where the same request returns the same response every time.
- You need to practice rare paths such as timeouts, duplicate webhooks, and failed delivery.
When the real sandbox is the right answer
- You are validating provider credentials, dashboard settings, or account capabilities.
- You need to confirm a provider-specific behavior that MockGateway intentionally simulates but does not certify.
- You are doing the final pre-launch pass before live payment traffic.
Start with the layer that answers today's question
Most teams should use both. Keep MockGateway in local development and CI so payment logic is exercised on every change. Then run a smaller, deliberate pass against the provider sandbox before launch, where the goal is provider validation rather than broad failure coverage.