Edits history of script submission #23790 for ' Retrieve Balance (stripe)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Retrieve Balance
     * Retrieve the account's available and pending balance, per currency, in the smallest currency unit.
     */
    export async function main(auth: RT.Stripe) {
      const response = await fetch(`https://api.stripe.com/v1/balance`, {
        headers: {
          Authorization: `Bearer ${auth.token}`,
          Accept: "application/json",
          "Stripe-Version": "2025-03-31.basil",
        },
      })
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      return await response.json()
    }
    

    Submitted by hugo989 3 hours ago