Testing Payments
Every supported payment processor provides a sandbox (test) environment that processes mock transactions without moving real money. This page covers how to configure each processor for testing and which test card numbers to use.
Important: Always verify your implementation in sandbox mode before switching to production credentials. Never use real card numbers in a sandbox environment.
Stripe
1. Get Sandbox Keys
- Log into your Stripe account at dashboard.stripe.com.
- Toggle the dashboard to Test mode using the switch in the top-left corner.
- Go to Developers → API Keys.
- Copy your Publishable key (
pk_test_...) and Secret key (sk_test_...).
2. Configure in Admin
Go to Admin → Payment Settings, select the Stripe tab, and enter your test keys. Leave the Webhook Secret empty for local testing.
3. Test Cards
| Card Number | Scenario | Exp / CVC |
|---|---|---|
| 4242 4242 4242 4242 | Successful payment | Any future date / Any 3 digits |
| 4000 0000 0000 0002 | Card declined | Any future date / Any 3 digits |
| 4000 0025 2000 3155 | Requires authentication (3D Secure) | Any future date / Any 3 digits |
| 4000 0000 0000 9995 | Insufficient funds | Any future date / Any 3 digits |
| 4000 0000 0000 0069 | Expired card | Any future date / Any 3 digits |
Full test card reference: docs.stripe.com/testing
4. Testing Webhooks Locally
To test webhook events on your local machine, use the Stripe CLI to forward events to your local server:
# Install Stripe CLI (macOS)
brew install stripe/stripe-cli/stripe
# Log in
stripe login
# Forward events to your local server
stripe listen --forward-to localhost:3000/api/webhooks/stripeThe CLI will output a webhook signing secret (whsec_...). Add it as STRIPE_WEBHOOK_SECRET in your .env file.
5. Switch to Production
Replace test keys with live keys from the Stripe dashboard (with Test mode toggled off). Create a new live webhook endpoint pointing to your production URL at https://yourdomain.com/api/webhooks/stripe.
Authorize.net
1. Create a Sandbox Account
- Go to developer.authorize.net/hello_world/sandbox and create a free sandbox account.
- Log into the sandbox merchant interface at sandbox.authorize.net.
- Navigate to Account → Settings → API Credentials & Keys.
- Note your API Login ID and generate a new Transaction Key.
- For Public Client Key, go to Account → Settings → Manage Public Client Key.
2. Configure in Admin
Go to Admin → Payment Settings, select the Authorize.net tab, set the environment to Sandbox, and enter your API Login ID, Transaction Key, and Public Client Key.
3. Test Cards
| Card Number | Scenario | Exp / CVC |
|---|---|---|
| 4111 1111 1111 1111 | Approved (Visa) | Any future date / Any 3 digits |
| 5424 0000 0000 0015 | Approved (Mastercard) | Any future date / Any 3 digits |
| 2223000010309703 | Approved (Mastercard 2-series) | Any future date / Any 3 digits |
| 4000 1234 5678 9010 | Declined | Any future date / Any 3 digits |
Full sandbox reference: developer.authorize.net/hello_world/testing_guide
4. Switch to Production
Change the environment toggle in Admin → Payment Settings from Sandbox to Production and replace with your live merchant credentials.
Clover
1. Create a Developer Account
- Go to sandbox.dev.clover.com and create a developer account.
- Create a test merchant in the developer dashboard.
- Navigate to your test merchant's settings and create a new app to obtain an API Access Token.
- Note your Merchant ID from the merchant URL.
2. Configure in Admin
Go to Admin → Payment Settings, select the Clover tab, set the environment to Sandbox, and enter your API Access Token and Merchant ID.
3. Test Cards
Clover sandbox accepts standard test card numbers. Use:
| Card Number | Scenario |
|---|---|
| 4111 1111 1111 1111 | Approved |
| 4000 0000 0000 0002 | Declined |
Clover developer docs: docs.clover.com/docs/testing-an-integration
4. Switch to Production
Change the environment to Production in admin settings and replace with live merchant credentials from clover.com/developers.
Square
1. Create a Square Developer Account
- Go to developer.squareup.com and create a developer account.
- Create a new application in the developer dashboard.
- Under your app's credentials, copy the Sandbox Application ID and Sandbox Access Token.
- Under Locations, copy your Sandbox Location ID.
2. Configure in Admin
Go to Admin → Payment Settings, select the Square tab, set the environment to Sandbox, and enter your Application ID, Location ID, and Access Token.
3. Test Cards
| Card Number | Scenario | Exp / CVC / ZIP |
|---|---|---|
| 4111 1111 1111 1111 | Approved (Visa) | Any future / 111 / 12345 |
| 4000 0000 0000 0002 | Card declined | Any future / 111 / 12345 |
| 5105 1051 0510 5100 | Approved (Mastercard) | Any future / 111 / 12345 |
Square test card reference: developer.squareup.com/docs/testing/test-values
4. Switch to Production
Replace sandbox credentials with production credentials from your Square Developer dashboard. Change the environment toggle to Production.
General Testing Checklist
Before going live with any processor, verify the following scenarios:
- Successful payment → order is created, confirmation email is sent
- Declined card → customer sees an error, no order is created
- Cart with coupon code applied → discount is reflected in the payment amount
- Checkout with multiple items → correct total is charged
- (Stripe) Webhook delivery → order status updates after async confirmation
See Payment Processors for configuration details, and Order Management for how order status works post-payment.