Testing a payment integration with sandbox keys before going live
Testing Payment Integration With Sandbox Keys Before Going Live With KorePay
The usual launch goes like this: a developer pastes in live keys, runs one purchase, sees a green tick and ships. Two days later a refund fails and nobody knows why. Test first, and the story changes. Casey, who runs a small ceramics shop, spent one afternoon in a sandbox before connecting KorePay to her store, and her launch day was dull. Dull is the goal. Here are five checks, ranked by the damage they prevent.
Why sandbox keys beat a nervous first live payment
A sandbox is a copy of the payment gateway that behaves like production but moves no real money. Test keys talk to the test environment. Live keys talk to the real one. Mixing them up is the classic mistake.
Casey wanted to accept online payments without handing customers a broken checkout. So she stored test keys and live keys in separate configuration files and labelled both clearly. That small habit meant a wrong key could never slip into production unnoticed. It paid off twice before she launched.
Five checks ranked by the damage they prevent
Open the dashboard at https://korepay.io/ and grab your test keys. The KorePay payment gateway offers a hosted payment page, a widget, payment links and subscriptions, so test the method you actually plan to use rather than all of them.
1. Webhook handling
Webhooks tell your server what really happened, and a missed one means an order that never ships. Send test events, confirm your endpoint answers quickly, and replay the same event twice. Your system should not create a duplicate order.
2. Refunds
Refunds fail in boring ways, such as a missing permission or an order ID that does not match. Pay for a test order, refund it, then check that your shop marks the order correctly. Casey found her stock count never went back up. She fixed it in minutes.
3. Declined and failed payments
Happy paths hide bugs. Trigger a decline, an expired card and an abandoned checkout using the test card details in the documentation. The customer should see a clear message and a way to retry, not a blank page.
4. 3-D Secure challenges
Many real customers will face an extra authentication step with 3-D Secure. Run a test payment that forces the challenge, then complete it and fail it. Make sure your site returns the buyer to the right page in both cases.
5. The full successful purchase
This one sounds obvious, which is why people rush it. Walk through the checkout like a customer would: add to cart, pay, receive the confirmation email. Check the amount, currency and order status at every step.
A scorecard to fill in before you swap keys
| Check | What to do | Pass condition |
|---|---|---|
| Successful payment | Complete a test purchase | Order marked paid, email sent |
| Decline | Use a failing test card | Clear error, retry possible |
| 3-D Secure | Pass and fail the challenge | Correct redirect both times |
| Webhook replay | Send the same event twice | No duplicate order |
| Refund | Refund a test order | Order and stock updated |
Once every row passes, switch to live keys. Make one small real purchase, refund it, and confirm the money trail in your KorePay dashboard. Finish identity verification early too. It takes a photo of an ID document and a short video selfie, and you do not want that step delaying launch day.
Questions merchants ask before swapping in live keys
Can I use sandbox keys to accept real online payments?
No. Sandbox keys only work in the test environment, so no real card is charged and no money arrives. You need live keys to accept online payments from customers.
How long should I test a payment gateway integration?
Long enough to pass every scenario in your scorecard, which for a small shop often means an afternoon. Larger setups with subscriptions need more time, because renewals and failed charges take extra cases to cover.
What should I check right after going live?
Place one low-value real order and refund it. Then confirm that the webhook arrived and the order status changed as expected.
Make launch day boring
Testing feels like delay, but it is the cheapest insurance a shop can buy. Casey’s checkout went live without a single support email, and she credits her scorecard. Run your own five checks with KorePay, keep test and live keys apart, and save the excitement for your first real sale.
