Skip to content

Instantly share code, notes, and snippets.

@sogamoso
Last active February 9, 2017 22:44
Show Gist options
  • Save sogamoso/8e3898e257134f0721cf to your computer and use it in GitHub Desktop.
Save sogamoso/8e3898e257134f0721cf to your computer and use it in GitHub Desktop.
> Stripe.api_key = 'sk_test_03vgOuyHUzwZw6ZhsnF2LfKr'
=> "sk_test_03vgOuyHUzwZw6ZhsnF2LfKr"
> account = Stripe::Account.create({ managed: true, country: 'US', email: "ride.test.account+#{Time.now.to_i}@ride.com", default_currency: 'USD', legal_entity: { type: 'individual', first_name: 'Freddie', last_name: 'Mercury', dob: { day: '5', month: '9', year: '1946' } } })
=> #<Stripe::Account:0x3ff3bdf9ac40 id=acct_17iRrhHthD3bQ2QR> JSON: { ...
> card_params = {number: '4000056655665556', exp_month: 12, exp_year: 2024, cvc: '314'}
=> {:number=>"4000056655665556", :exp_month=>12, :exp_year=>2024, :cvc=>"314"}
> token = Stripe::Token.create(card: card_params).id
=> "tok_17iRuAJaOsq4HqOZcQ8QcZlF"
> card = account.external_accounts.create(external_account: token, default_for_currency: true)
Stripe::InvalidRequestError: You must provide a card that has the 'currency' field set when adding a card to a Stripe account.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment