Setup intent error

Martin McDermid
Hey.

Using your documentation to add in a one-time payment, I'm receiving this error:

undefined local variable or method `setup_intent'

Extracted source (around line #10): 
stripe_setup_intent: setup_intent.client_secret,

Everything works of course if the user already has a card stored.

My form:
<% if !current_account.card_type? %>
  <p>First, add a payment method to your account:</p>
  <%= render 'cards/forms/stripe'    if Jumpstart.config.stripe? %>
  <%= render 'cards/forms/braintree' if Jumpstart.config.braintree? %>
  <%= render 'cards/forms/paypal'    if Jumpstart.config.paypal? %>
<% else %>
  <%= render 'form', advert: @advert %>
<% end %>

I assume I've missed something silly... any help?

Martin McDermid
Chris Oliver Any ideas?
Ryan Chin
I'm running int this same error

Showing /mnt/c/sites/viderful/app/views/cards/forms/_stripe.html.erb where line #9 raised:
undefined local variable or method `setup_intent' for #<ActionView::Base:0x000000000e1028>

Extracted source (around line #9):
    controller: "stripe",

    action: "keydown->stripe#keydown",

    stripe_setup_intent: setup_intent.client_secret,

    stripe_target: "form",

    toggle_target: "toggleable",

  } do |f| %>


Martin McDermid were you ever able to find a solution?  Thanks!

I'm trying to get one-time payments to work in my app, so I followed the directions under One-time payments, and copied the code into my view

    <% if !current_account.card_type? %>
      <p>First, add a payment method to your account:

      <%= render 'cards/forms/stripe'    if Jumpstart.config.stripe? %>
      <%= render 'cards/forms/braintree' if Jumpstart.config.braintree? %>
      <%= render 'cards/forms/paypal'    if Jumpstart.config.paypal? %>
    <% else %>
      <%= render 'form', license: @license %>
    <% end %>

This results in the error.
Mikael Henriksson
If you have a look at the app/views/cards/edit.html file it says:

<%= render 'cards/forms/stripe', button: "Update Card", url: card_path, method: :put, setup_intent: @setup_intent if Jumpstart.config.stripe? %>

Maybe you need something similar for the new.html?
Gregory Mendes
I had the same issue, fixed with:

app/views/cards/forms/_stripe.html.erb
@setup_intent.try(:client_secret)
Notifications
You’re not receiving notifications from this thread.
Subscribe
© 2021 GoRails, LLC