Stripe Files API

  • Goal: I am trying to use the Stripe connector to add files from retool to Stripe to support dispute management

  • Steps: I am using the v1/files API to connect to stripe. We have tried multiple different ways to reference the file (URL, S3, Local Storage, retool file input) but every time we try to submit we get the same error "Invalid Object"

Has anyone leveraged the stripe files api from retool in the past? If so, would you be willing to give some insight on how you structured the file path to get it to work?

Hey @Ian_Stribling ,

I've been trying to fix this issue, but I haven't had any success. The default Stripe query in Retool doesn't accept the body content type, even when I create a REST API.

I'm using FileInput to send data and have tried using a transformer and posting the data as a string, but it's still not working.

I've also attempted different content types, including JSON, Raw, and x-www-form-urlencoded, but none of them seem to fix the issue.

Can the Retool team take a look at this issue?
@Paulo ,@Jack_T .

Thank You.

3 Likes

Hi @Ian_Stribling and @WidleStudioLLP,

Let me try to reproduce this and see if I can reproduce this bug to send to our engineers or if there is any workaround.

Apologies for the inconvenience!

1 Like

Hi @Ian_Stribling,

It looks like this bug has an internal ticket for it so I just added this thread onto it and added a +1. Apologies for the inconvenience, will update this thread with any news I hear from the team.

@WidleStudioLLP I was thinking that using a REST API resource might be the best work around. But that is odd that you are getting a different error.

Inside of your query body under file, could you try {{ fileInput1.value[0].base64Data }} to see if directly passing the base64 encoded string might be the payload that the API can accept?

Hey @Jack_T ,

Thank you for your response. I have already tried using Base64, but the issue persists. I also attempted sending the data as a string, but it still didn't work.
can See The Screenshot & error

image

image

{
  "request": {
    "url": "https://files.stripe.com/v1/files",
    "method": "POST",
    "body": "{\"purpose\":\"identity_document\",\"file\":\"UEsDBBQAAAAIAHMqRloKCHnMCwEAAKgCAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbK2SvU4DMRCEe57CchvFTigQQndJEaAEivAAi2/vzor/5HXC3dvjcwIFCqRJZdk7M99o5Wo9WMMOGEl7V/OlWHCGTvlGu67m79vn+T1nlMA1YLzDmo9IfL26qbZjQGLZ7KjmfUrhQUpSPVog4QO6PGl9tJDyNXYygNpBh/J2sbiTyruELs3TlMFX1SO2sDeJPQ35+VgkoiHONkfhxKo5hGC0gpTn8uCaX5T5iSCys2io14FmWcDlWcI0+Rtw8r3mzUTdIHuDmF7AZpUcjPz0cffh/U78H3KmpW9brbDxam+zRVCICA31iMkaUU5hQbvZZX4RkyzH8spFfvIv9KA0GqRrb6GEfpNl+WirL1BLAwQUAAAd04w1mvFMvbrG0ZxRNDA1UM4LMEgd+0DHBva7zc8SjCZH3o1M2MANFVbtrL6wnA7MJ5P9pA0MKU2VtdoNGJ3OeULKSs8SXcqnHK1Ogs7rgJjiaH+LYmGjCwSvhEq+yeC+Dx2uufuPSOkVIji6lNvrECaFtn5+0DcacjG3/nvwMi954NbnoWCkCpnI1pdg29p+bPazrLTogV0kgR0QBkI/gxMJgEKu+Oig+PLBIVCkL16TBwpc0Vx/tJ7YGlHNDhQzxa0scCAAD9BgAADQAAAAAAAAAAAAAAAAD8AwAAeGwvc3R5bGVzLnhtbFBLAQIAABQAAAAIAHMqRlpeR+VyViwAAFcPAgAYAAAAAAAAAAAAAAAAAO4GAAB4bC93b3Jrc2hlZXRzL3NoZWV0MS54bWxQSwUGAAAAAAYABgCAAQAAejMAAAAA\"}",
    "headers": {
      "Content-Type": "multipart/form-data; boundary=form-data-boundary-3f5xgq60u7ph7k1k",
      "User-Agent": "Retool/2.0 (+https://docs.tryretool.com/docs/apis)",
      "Authorization": "---sanitized---",
      "ot-baggage-requestId": "undefined",
      "x-datadog-trace-id": "6688754371668321615",
      "x-datadog-parent-id": "8160798037817259477",
      "x-datadog-sampling-priority": "0",
      "x-datadog-tags": "_dd.p.tid=67b6b14200000000",
      "traceparent": "00-67b6b142000000005cd33aa99921a54f-7140fa93dfcd75d5-00",
      "tracestate": "dd=t.tid:67b6b14200000000;t.dm:-1;s:0;p:7140fa93dfcd75d5",
      "X-Retool-Forwarded-For": "122.170.45.201"
    }
  },
  "response": {
    "data": {
      "error": {
        "message": "Invalid request (check your POST parameters): For assistance, contact support at https://support.stripe.com/contact/.",
        "type": "invalid_request_error"
      }
    },
    "headers": {
      "server": [
        "nginx"
      ],
      "date": [
        "Thu, 20 Feb 2025 04:36:19 GMT"
      ],
      "content-type": [
        "application/json"
      ],
      "content-length": [
        "193"
      ],
      "connection": [
        "keep-alive"
      ],
      "access-control-allow-credentials": [
        "true"
      ],
      "access-control-allow-methods": [
        "DELETE, GET, HEAD, PATCH, POST, PUT"
      ],
      "access-control-allow-origin": [
        "*"
      ],
      "access-control-expose-headers": [
        "Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required"
      ],
      "access-control-max-age": [
        "300"
      ],
      "content-security-policy": [
        "base-uri 'none'; default-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src 'self' 'report-sample'; style-src 'self'; worker-src 'none'; upgrade-insecure-requests; report-uri https://q.stripe.com/csp-violation?q=EdbDAEyp-9gJWT-1yZS-FbS17rSh4XZ0fmOYODvHAIi5wHcgKG_4YRcD6VrCGqujN3iFBaN7ug%3D%3D"
      ],
      "report-to": [
        "{\"group\":\"coop\",\"max_age\":8640,\"endpoints\":[{\"url\":\"https://q.stripe.com/coop-report\"}],\"include_subdomains\":true}"
      ],
      "reporting-endpoints": [
        "coop=\"https://q.stripe.com/coop-report\""
      ],
      "vary": [
        "Origin"
      ],
      "x-content-type-options": [
        "nosniff"
      ],
      "x-wc": [
        "ABCD"
      ],
      "strict-transport-security": [
        "max-age=63072000; includeSubDomains; preload"
      ]
    },
    "status": 400,
    "statusText": "Bad Request"
  }
}
2 Likes

Thank you for testing out all those options for the file upload.

Just added those details to the bug ticket I filed for this. Will update this thread with any news from the engineering team. Seems like it is an issue with how our query builder is formatting the request before dispatching it.

I was just going over the stripe docs here and it seems like you did everything correct. Very odd bug, hopefully we can get it resolved shortly.

1 Like