Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe::InvalidRequestError: Some of the parameters you provided (payment_method) cannot be used when modifying a SetupIntent that was created by Checkout. / Ruby example / #stripe ) #3049

Open
YumaInaura opened this issue Mar 27, 2020 · 0 comments

Comments

@YumaInaura
Copy link
Owner

require 'stripe'

Stripe.api_key = ENV['STRIPE_SECRET_KEY']

checkout_session = Stripe::Checkout::Session.create(
  payment_method_types: ['card'],
  mode: 'setup',
  success_url: 'http://example.com',
  cancel_url: 'http://example.com'
)

payment_method = Stripe::PaymentMethod.create(
  type: 'card',
  card: { number: '4242424242424242', exp_year: 2030, exp_month: 01}
)

# Stripe::InvalidRequestError:
# Some of the parameters you provided (payment_method) cannot be used when modifying a SetupIntent that was created by Checkout.
# You can try again without those parameters.

Stripe::SetupIntent.update(
  checkout_session.setup_intent,
  {payment_method: payment_method.id},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant