Stripe API Version

  • Goal: I want to set the version of the stripe api in the HEADERS, I am setting it in the Resources but it doesn't seem to work. We have multiple versions in our Stripe Account and we also have set the default to a 2015 version which doesn't allow a lot of queries to be used.

  • Steps: I have set the version of the API to the resources when I set it up and it doesn't seem to work. I have tried both LIVE and TEST keys from Stripe

  • Details: I cannot set the Stripe-Version HTTP header to a specific version.

  • Screenshots:
    image

1 Like

Welcome to the community @Panagiotis_Tsagkaris
I've never setup their API but just to make sure, there is no option to setup the header or its not working?

1 Like

Hi,

Thank you for the quick reply!

When I setup the resource it asks me for the API Version as you can see in the screenshot though this doesn't seem to do anything in terms of setting a header. It might be so it loads the available paths.

And yes there is not an option to setup up a custom Header in the Request.

Maybe you can write up JS query directly in retool to try and set header that way, tho not sure if it will work.

const url = 'https://api.stripe.com/v1/customers';
const apiKey = 'test12345'; // Replace with your API key, probably available in dashboard
const stripeVersion = '2024-06-28'; // not sure which version is applicable, 
const headers = {
  'Authorization': `Bearer ${apiKey}`
};

fetch(url, {
  method: 'GET',
  headers: headers
})
  .then(response => {
    if (!response.ok) {
      throw new Error('Network response was not ok ' + response.statusText);
    }
    return response.json();
  })
  .then(data => {
    console.log(data);
    return data;
  })
  .catch(error => {
    console.error('There has been a problem with your fetch operation:', error);
  });

not sure if this is gonna work, but worth a try

Thank you for the snippet.

But we have our own API that wraps around Stripe already so I can invoke that, the handy was the fact that Retool already has its own integration and it seems to only be missing the addition of the version in the header.

The other solution which currently is not an option is to the default version of the Stripe API to a version that Retool supports but we are not sure about that as it might break logic infrastructure.

Instead of that, a simple addition to the UI of Retool to set the header on the Stripe Resource would fix all that.

I conveniently just made a test account this morning to help someone else out with this api.

this is used for webhooks

image
to change it you can POST to /webhook_endpoint/{id} or on the dashboard you can add a new endpoint

if you're using stripe.js you can include an options object { apiVersion: <version_num> } as a 2nd parameter to most function calls to override this. if you don't supply one it defaults to the newest.

1 Like

just went over that post and wanted to summon you here, but no need, you are omnipresent :rofl:

1 Like