1
Capture a Payment Intent
One script reply has been approved by the moderators Verified

Capture the funds of an existing uncaptured payment intent. See the docs for more information

Created by rossmccrann 852 days ago Viewed 9308 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, id: string) {
5
  const STRIPE_CAPTURE_PAYMENT_URL = `https://api.stripe.com/v1/payment_intents/:${id}/capture`;
6

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

9
  const response = await fetch(STRIPE_CAPTURE_PAYMENT_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