Generate a Stripe test card token for testing

You don't need to create tokens with fake credit cards for testing anymore. Stripe now provides a list of pre-made tokens for this purpose :

Stripe docs : Test card numbers and tokens


Stripe provides an API call to create tokens from the server:

\Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2");

\Stripe\Token::create(array(
  "card" => array(
    "number" => "4242424242424242",
    "exp_month" => 1,
    "exp_year" => 2017,
    "cvc" => "314"
  )
));

edit: Stripe now provides ready-to-use test tokens like tok_visa at https://stripe.com/docs/testing#cards.