上传文件以解决 Stripe 托管帐户验证问题

Upload files for Stripe managed account verification issue

我正在尝试上传文件(从 Linux 机器上的 Chrome 浏览器)到 Stripe 的服务器,Stripe 服务器的响应是

com.stripe.exception.InvalidRequestException: File for key file must exist.

问题来自表单提交路径中的 C:/fakepath/file-name 当我在上传时硬编码它的原始路径时,它有效!

如何解决这个问题? 谢谢

该消息不是来自 Stripe 的 API,而是来自 Java 绑定本身:https://github.com/stripe/stripe-java/blob/c7d26216b09a5a5b288ef5550c59979209979bc5/src/main/java/com/stripe/net/LiveStripeResponseGetter.java#L529-L530

重用 example from Stripe's API reference:

Stripe.apiKey = "sk_test_...";

Map<String, Object> fileUploadParams = new HashMap<String, Object>();
fileUploadParams.put("purpose", dispute_evidence);
fileUploadParams.put("file", new File('/path/to/a/file.jpg'));

FileUpload fileUpload = FileUpload.create(fileUploadParams);
如果 /path/to/a/file.jpg 不存在,

将导致完全相同的错误。