Create a Payout

Send funds to your own bank account. Your Stripe balance must be able to cover the payout amount, or you'll receive an 'Insufficient Funds' error. [See the docs](https://stripe.com/docs/api/payouts/create) for more information

Script stripe Verified

by rossmccrann ยท 8/23/2022

The script

Submitted by rossmccrann Deno
Verified 372 days ago
1
import Stripe from "https://esm.sh/stripe?target=deno";
2

3
type Stripe = {
4
  token: string;
5
};
6
export async function main(
7
  stripe_con: Stripe,
8
  amount: number,
9
  currency: string
10
) {
11
  const token = stripe_con["token"];
12
  const stripe = Stripe(`${token}`, {
13
    httpClient: Stripe.createFetchHttpClient(),
14
  });
15

16
  const payout = await stripe.payouts.create({
17
    amount: amount,
18
    currency: `${currency}`,
19
  });
20

21
  return await payout.json();
22
}
23