Guides / CyberSource

How to Test Cybersource Payments in WooCommerce (Sandbox Guide)

Test Cybersource Payments Before Going Live: Sandbox keys, test cards and the scenarios to run.

Before you take real money through Cybersource, run your WooCommerce checkout against the Cybersource sandbox. You can place orders with test cards, check approvals and declines, and try refunds and captures without charging anyone. This guide covers the setup, the test card numbers, what to test and how to switch to live.

How do I test Cybersource payments in WooCommerce?

Short answer: Create REST API keys in the Cybersource test Business Center (businesscentertest.cybersource.com), set the plugin’s Environment to Test, and enter the test Merchant ID and keys in WooCommerce. Then place orders with Cybersource test cards, such as Visa 4111 1111 1111 1111 with any future expiry date, and confirm each one in the test Business Center.

Step 1: Get a sandbox account and test keys

  1. If you don’t have a test account yet, create a free sandbox account on the Cybersource developer site. If you already have a merchant account, ask Cybersource for its test Business Center login.
  2. Sign in to https://businesscentertest.cybersource.com/ebc2.
  3. Go to Payment Configuration › Key Management and generate a REST shared secret key. Copy the Key ID and the Shared Secret; the secret is shown only once.
  4. For Unified Checkout, enable the payment methods you want to test under Payment Configuration › Unified Checkout. The Unified Checkout setup guide walks through each screen.

Using the Secure Acceptance gateway instead? Create the profile and keys in the same test Business Center: see how to create a Secure Acceptance profile and how to generate the access key and secret key.

Step 2: Put the WooCommerce plugin in test mode

  1. Go to WooCommerce › Settings › Payments and open the Cybersource gateway.
  2. Set Environment to Test.
  3. Enter the test Merchant ID, REST API Key ID and Shared Secret.
  4. Turn on Debug Mode / Logging while you test, so every request and response is written to WooCommerce › Status › Logs.
  5. Save, then open your checkout in a private browser window.

Test keys only work with the Test environment, and live keys only with Live. Mixing them is the most common reason the payment form fails to load. If that happens, see how to fix “call failed” errors.

Step 3: Use Cybersource test cards

Enter the full card number, any expiry date in the future and the CVV shown. These cards only work in the sandbox and never move real money.

Card brandTest card numberCVV
Visa4111 1111 1111 1111123
Mastercard5555 5555 5555 4444265
American Express3782 8224 6310 0057890
Discover6445 6445 6445 6445123
JCB3530 1113 3330 0000123
Diners Club3056 9309 0259 04123
Maestro6759 6498 2643 8453123
China UnionPay6279 8862 4809 4966123
Cartes Bancaires4360 0000 0100 0005123
mada4464 0400 0000 0007123
ELO4514 1600 0000 0003123
EFTPOS4017 9500 0000 0009123
Meeza5078 0830 0000 0002123

A brand only works if it is enabled for your test merchant ID and selected under Allowed Card Networks in the plugin. Visa and Mastercard are enough for most tests.

Step 4: Run these test scenarios

TestHowWhat should happen
Approved paymentVisa or Mastercard test cardOrder moves to Processing, and the transaction shows in the test Business Center
Expired cardAny test card with a past expiry dateDeclined with a clear message, and the order stays unpaid
Invalid card numberChange one digit of a test cardRejected by the card form before submission
Authorize, then captureSet Payment Action to Authorize only and place an orderOrder is On hold. Capturing from the order screen completes it
RefundRefund a paid order from the WooCommerce order screenThe refund appears on the order and in the Business Center
Saved cardAdd a card from My Account, then pay with itCheckout offers the saved card and the payment is approved
Subscription renewalBuy a subscription product, then process a renewal from the subscription screenThe renewal is charged to the saved token
Block and classic checkoutRepeat the approved payment on both, if you use bothSame result on each

To check a result, open Transaction Management › Transactions in the test Business Center and search for the WooCommerce order number.

Testing declines and 3D Secure

In the sandbox, specific declines and 3D Secure challenges are triggered by test values that depend on your processor and Payer Authentication setup. Use the numbers in Cybersource’s testing guides for your processor and for Payer Authentication, rather than random cards, so you can tell a configuration problem from an expected decline.

Testing Apple Pay and Google Pay

Wallets need their own enrollment and domain verification before they appear, even in test mode. The Apple Pay and Google Pay enrollment guide covers both.

Step 5: Switch from sandbox to live

  1. In the live Business Center (businesscenter.cybersource.com), generate new REST keys. Test keys never work in production.
  2. Enable the same payment methods, fraud settings and 3D Secure on the live merchant ID. They don’t carry over from test.
  3. Set Environment to Live and enter the live Merchant ID and keys.
  4. Place one small real order with your own card, then refund it.
  5. Turn off debug logging.

Frequently asked questions

Do Cybersource test cards charge real money?

No. Test cards only work in the Cybersource sandbox, and the test environment never sends transactions to a real bank. Entered in a live store, they are simply declined.

What expiry date should I use with test cards?

Any date in the future. An expiry date in the past is useful when you want to test an expired-card decline.

Why does my test order fail with valid test cards?

Check that the plugin’s Environment is Test, that the keys come from the test Business Center, and that the card brand is enabled for your merchant ID and in the plugin. The WooCommerce debug log shows Cybersource’s exact response.

Can I test on a staging site?

Yes, as long as it runs on HTTPS. For Unified Checkout, the payment form only loads on the domain the session was created for, so load the staging site on its own address rather than through a proxy.

Leave a Reply

Your email address will not be published. Required fields are marked *