Skip to content

Instantly share code, notes, and snippets.

@mscoutermarsh
Last active September 7, 2016 19:52
Show Gist options
  • Save mscoutermarsh/bd462b009cf6210a01b1906e6f7e17fb to your computer and use it in GitHub Desktop.
Save mscoutermarsh/bd462b009cf6210a01b1906e6f7e17fb to your computer and use it in GitHub Desktop.
Ruby - create Stripe token for testing

If you need to create a Stripe token for testing. Do this.

Stripe::Token.create(
  :card => {
    :number => "4242424242424242",
    :exp_month => 9,
    :exp_year => 2017,
    :cvc => "314"
  },
)

Will give you a token just like you'd get from Stripe Checkout.

Note - a token can only be used once. You'll have to regenerate if using again.

I recommending generating once - recording all requests to VCR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment