TestCardsGet a free key

Test cards for Playwright

Drive a payment form in Playwright with a deterministic test card. Use a decline number to assert your error-handling path.

Example

Playwright · ts
// tests/checkout.spec.ts
import { test, expect } from "@playwright/test";

const SUCCESS = "4242424242424242"; // Visa, succeeds
const DECLINE = "4000000000000002"; // generic decline

test("checkout succeeds", async ({ page }) => {
  await page.goto("/checkout");
  const frame = page.frameLocator("iframe").first();
  await frame.getByPlaceholder("Card number").fill(SUCCESS);
  await frame.getByPlaceholder("MM / YY").fill("12/34");
  await frame.getByPlaceholder("CVC").fill("123");
  await page.getByRole("button", { name: "Pay" }).click();
  await expect(page.getByText("Payment succeeded")).toBeVisible();
});

Test card numbers

The standard Stripe test numbers — successes and declines you can wire into your Playwright suite.

Successful payments

Cards that complete a charge in test mode.

NumberBrandBehavior (test mode)
4242 4242 4242 4242
VisaSucceeds and immediately processes the payment.
4000 0566 5566 5556
Visa (debit)Succeeds; card type is debit.
5555 5555 5555 4444
MastercardSucceeds and immediately processes the payment.
2223 0031 2200 3222
Mastercard (2-series)Succeeds; tests the 2221–2720 range.
5200 8282 8282 8210
Mastercard (debit)Succeeds; card type is debit.
5105 1051 0510 5100
Mastercard (prepaid)Succeeds; card type is prepaid.
3782 822463 10005
American ExpressSucceeds; 15-digit PAN, 4-digit CID.
3714 496353 98431
American ExpressSucceeds; alternate Amex test number.
6011 1111 1111 1117
DiscoverSucceeds and immediately processes the payment.
3056 9300 0902 0004
Diners ClubSucceeds; 14-digit Diners Club.
3566 0020 2036 0505
JCBSucceeds and immediately processes the payment.
6200 0000 0000 0005
UnionPaySucceeds and immediately processes the payment.

Declines & errors

Trigger specific decline codes to test your error handling.

NumberBrandBehavior (test mode)
4000 0000 0000 0002
VisaCharge is declined with a generic decline code.
4000 0000 0000 9995
VisaDeclined: insufficient_funds.
4000 0000 0000 9987
VisaDeclined: lost_card.
4000 0000 0000 9979
VisaDeclined: stolen_card.
4000 0000 0000 0069
VisaDeclined: expired_card.
4000 0000 0000 0127
VisaDeclined: incorrect_cvc.
4000 0000 0000 0119
VisaDeclined: processing_error.
4100 0000 0000 0019
VisaDeclined: flagged as fraudulent (Radar).

Use any future expiry date (e.g. 12 / 34) and any postal code. Behaviors shown are for Stripe’s test mode; other processors publish their own test numbers. These cards are non-functional fixtures — they will be declined in production.

More frameworks:CypressJestVitest