1
Cancel Or Reverse a Payout
One script reply has been approved by the moderators Verified

Cancel or reverse a payout. A payout can be canceled only if it has not yet been paid out. A payout can be reversed only if it has already been paid out. Funds will be refunded to your available balance. See the docs for more information.

Created by rossmccrann 852 days ago Viewed 9576 times
0
Submitted by rossmccrann Deno
Verified 852 days ago
1
type Stripe = {
2
  token: string;
3
};
4
export async function main(stripe_con: Stripe, payout_id: string) {
5
  const STRIPE_REVERSE_PAYOUT_URL = `https://api.stripe.com/v1/payouts/:${payout_id}/reverse`;
6

7
  const token = stripe_con["token"];
8

9
  const response = await fetch(STRIPE_REVERSE_PAYOUT_URL, {
10
    method: "POST",
11
    headers: {
12
      Authorization: "Bearer " + token,
13
      "Content-Type": "application/json",
14
    },
15
  });
16

17
  return await response.json();
18
}
19