Skip to content

Instantly share code, notes, and snippets.

@michaelschade
Created June 7, 2014 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelschade/6c70f1774b7510d32b86 to your computer and use it in GitHub Desktop.
Save michaelschade/6c70f1774b7510d32b86 to your computer and use it in GitHub Desktop.
[2] pry(main)> Stripe::VERSION
=> "1.11.0"
[3] pry(main)> Stripe.api_key = '[redacted]'
=> "[redacted]"
[4] pry(main)> Stripe.api_version = '2014-01-31'
=> "2014-01-31"
[7] pry(main)> begin
[7] pry(main)* Stripe::Customer.create(email: 'baz@example.com', card: { number: '4000000000000002', exp_month: 12, exp_year: 2014 }, metadata: { profile_id: '100' })
[7] pry(main)* rescue Stripe::CardError => exception
[7] pry(main)* puts "Encountered a card error..."
[7] pry(main)* puts exception.inspect
[7] pry(main)* rescue
[7] pry(main)* puts "Hmm, something else went wrong."
[7] pry(main)* end
Encountered a card error...
#<Stripe::CardError: (Status 402) Your card was declined.>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment