Hello there!

@Redash team, do you have any plans regarding Stripe as a data-source integration? Especially Stripe billing?

Thank you

2 Likes

Hi,

While we would love to support Stripe better (we’re Stripe users too), we currently don’t have such plans. Stripe doesn’t really have a query API, so it’s less likely anything useful can be done without actually storing the data elsewhere.

But I might be wrong :sweat_smile: Can you elaborate on how you wanted to use such integration?

Also, one possible workaround is to use something like Stitch to load data from Stripe into a database and then query it from Redash.

1 Like

Hey Arik, thanks for your quick reply!
Stripe does provide a query API in the sense that you could query its resources using filters (like payments, payouts, subscriptions, etc.) => For example : https://stripe.com/docs/api/subscriptions/list?lang=python.
It could be a mix of MongoDB and GoogleAnalytics “kinda” query:
{
“resource”: “subscriptions”,
“filter”: {
“customer”: “cus_FHGkt64ikHKpqt”,
}
}

What do you think?

You can use the JSON data source to load this already. Here’s an example query:

url: https://api.stripe.com/v1/subscriptions
auth: ['your-stripe-key','']
params:
    customer: 'cus_EAnzwJSYvu0IeG'
path: data

This will return the subscription for this customer. You can also set the API key in the data source settings (as the Basic Auth user) to avoid having to repeat it in the query.

See the JSON data source page in the Knowledge Base for more information.

1 Like

Thank you so much! I will try that ASAP.

Ok so I tried and it works nice and easy.

Only problem is, it can’t handle pagination.
Stripe does not use a classic ?page=&perPage or a ?limit&offset but instead uses object IDs to query items after or before them : https://stripe.com/docs/api/pagination

Do you have any idea on how to circumvent this issue? A cool feature would be to map query parameters or request headers in the parameters of the JSON data source. I picture something like that:

url: https://api.stripe.com/v1/subscriptions
auth: ['your-stripe-key','']
pagination:
    mode: 'cursor-based',
    params: 
        limit: 'limit'
        before_cursor: 'ending_before'
        after_cursor: 'starting_after'
    paths:
        has_more: 'has_more',
        cursor: 'id'
params:
    customer: 'cus_EAnzwJSYvu0IeG'
path: data

And here’s a variant for page based pagination:

url: https://randomapi.com
pagination:
    mode: 'page-based',
    params: 
         page: 'page'
         per_page: 'limit'
    paths:
         page_count: 'count'
         per_page: 'perPage'
params:
    customer: 'cus_EAnzwJSYvu0IeG'
path: data

What do think of that? :blush:

1 Like

Hey Arik,
Any development regarding a potential Stripe integration?
Can we help?

It’s not a priority but we’re happy to review a pull request implementing a stripe integration. You can probably just fork the JSON data source and adjust as needed.