OpenSky-commerce / Documentation

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

  1. Log into your Stripe account at dashboard.stripe.com.
  2. Toggle the dashboard to Test mode using the switch in the top-left corner.
  3. Go to Developers → API Keys.
  4. 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 NumberScenarioExp / CVC
4242 4242 4242 4242Successful paymentAny future date / Any 3 digits
4000 0000 0000 0002Card declinedAny future date / Any 3 digits
4000 0025 2000 3155Requires authentication (3D Secure)Any future date / Any 3 digits
4000 0000 0000 9995Insufficient fundsAny future date / Any 3 digits
4000 0000 0000 0069Expired cardAny 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/stripe

The 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

  1. Go to developer.authorize.net/hello_world/sandbox and create a free sandbox account.
  2. Log into the sandbox merchant interface at sandbox.authorize.net.
  3. Navigate to Account → Settings → API Credentials & Keys.
  4. Note your API Login ID and generate a new Transaction Key.
  5. 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 NumberScenarioExp / CVC
4111 1111 1111 1111Approved (Visa)Any future date / Any 3 digits
5424 0000 0000 0015Approved (Mastercard)Any future date / Any 3 digits
2223000010309703Approved (Mastercard 2-series)Any future date / Any 3 digits
4000 1234 5678 9010DeclinedAny 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

  1. Go to sandbox.dev.clover.com and create a developer account.
  2. Create a test merchant in the developer dashboard.
  3. Navigate to your test merchant's settings and create a new app to obtain an API Access Token.
  4. 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 NumberScenario
4111 1111 1111 1111Approved
4000 0000 0000 0002Declined

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

  1. Go to developer.squareup.com and create a developer account.
  2. Create a new application in the developer dashboard.
  3. Under your app's credentials, copy the Sandbox Application ID and Sandbox Access Token.
  4. 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 NumberScenarioExp / CVC / ZIP
4111 1111 1111 1111Approved (Visa)Any future / 111 / 12345
4000 0000 0000 0002Card declinedAny future / 111 / 12345
5105 1051 0510 5100Approved (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.