In your Ad
model, you have:
attr_accessor :stripe_card_token
and then you use the token in save_with_payment
:
customer = Stripe::Customer.create(..., card: stripe_card_token)
self.stripe_customer_token = customer.id
So far so good. But you use ad_params
to filter params
in your controller when you create your Ad
:
def ad_params
params.require(:ad).permit(:title, :url, :preview, :location, :size, :info, :search)
end
and I don't see :stripe_card_token
in the permitted list anywhere. Presumably the #ad_stripe_card_token
in your HTML looks like this:
<input type="hidden" name="ad[stripe_card_token]">
so you should be able to add :stripe_card_token
to the permitted list in ad_params
and get things going.