tansengming / stripe-rails

A Rails Engine for integrating with Stripe
MIT License
753 stars 123 forks source link

Allow stripe_elements_tag to accept a block #228

Closed chip closed 5 months ago

chip commented 6 months ago

Hello and thanks for creating this gem!

I needed to pass some form fields to stripe_elements_tag, so I've implemented it here. The Gemfile and test/spec_helper.rb changes were to simply get the tests to pass.

I'm happy to make changes if there's a better way. I hope you find this useful.

tansengming commented 5 months ago

Can you do me a favor? Do you have a link to the Stripe docs for custom elements? I couldn't find anything about it on the web.

chip commented 5 months ago

Can you do me a favor? Do you have a link to the Stripe docs for custom elements? I couldn't find anything about it on the web.

@tansengming - It's been a while since I made these changes, so I'm drawing a blank and the Stripe docs are a tad bit insane. I would be happy to continue looking, though, if you have any suggestions. Cheers.

tansengming commented 5 months ago

looks good thanks @chip !

tansengming commented 5 months ago

Can you do me a favor? Do you have a link to the Stripe docs for custom elements? I couldn't find anything about it on the web.

@tansengming - It's been a while since I made these changes, so I'm drawing a blank and the Stripe docs are a tad bit insane. I would be happy to continue looking, though, if you have any suggestions. Cheers.

Feel free to post it here once you find the url. It'll be good to have a reference in case we need it.

chip commented 5 months ago

Can you do me a favor? Do you have a link to the Stripe docs for custom elements? I couldn't find anything about it on the web.

@tansengming - It's been a while since I made these changes, so I'm drawing a blank and the Stripe docs are a tad bit insane. I would be happy to continue looking, though, if you have any suggestions. Cheers.

Feel free to post it here once you find the url. It'll be good to have a reference in case we need it.

Sure, I followed this example (using Sinatra) to get me started.

The billing_path should point to a Rails controller method that captures the params[:user][:email] field in my example and sets it on the metadata of the Stripe PaymentIntent.

HTH 😄