Got a cool example to share? Get listed here! Submit it now.

useChainlinkFunctions()

Collection of community submitted examples for Chainlink Functions

Get inspired from quick examples

Chainlink Functions, a new self-service platform that allows anyone to write serverless code to fetch any data from any API and run custom compute on Chainlink's network. Learn from examples created by the community or contribute your own!
Learn more about Chainlink Functions

Fetch and return available balance of Stripe account

Submitted by:
Karen Stepanyan
This function will fetch Stripe account available balance of particular currency.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 const apiKey = secrets.API_KEY const balanceCurrency = args[0] || 'usd' if (!apiKey) { throw Error("Stripe API Key is required") } const config = { url: `https://${apiKey}@api.stripe.com/v1/balance`, } const response = await Functions.makeHttpRequest(config) const balance = response.data.available.find(c => c.currency.toLowerCase() === balanceCurrency.toLowerCase()) const balanceInCents = Math.round(balance.amount * 100) return Functions.encodeUint256(balanceInCents)