-
Notifications
You must be signed in to change notification settings - Fork 552
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
Support uploading files from multipart forms in Rails #615
Comments
In the interest of sharing, I thought it could be worth mentioning that If you wanted to maintain the same API you could do the same thing. |
Hi @kimroen, thanks for the report! We recently reintroduced support for uploading Stripe::FileUpload.create({
purpose: 'identity_document',
file: image.tempfile
}) using the latest stripe-ruby. That said, your proposal of mimicking rest-client's behavior makes a lot of sense! I'll run some tests and push a patch unless I run into any surprises. |
We've released @ob-stripe's patch in 3.9.1. |
Perfect, thank you both ❤️ |
Hi! Recently, our form to upload verification documents to Stripe stopped working.
We do something that can be boiled down to this:
In the template:
In the controller
After some digging, we realized that this started failing because Rails represents the uploaded file as an instance of
ActionDispatch::Http::UploadedFile
, and that Stripe now doesn't handle getting one of these passed in any more after switching fromrest-client
toFaraday
.Luckily in 1.8.1 the stripe gem introduced support for passing in a
Tempfile
, and you can get one of those out of theActionDispatch::Http::UploadedFile
instance by callingtempfile
on it, so this fixed it for us:I understand the intention here is to not break the old behavior, so I just wanted to both let you know about this and document the fix so other people don't have to go spelunking like we did 👍
The text was updated successfully, but these errors were encountered: