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

Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, Stripe will attempt to initiate a payment. See the docs for more information

Created by rossmccrann 604 days ago Viewed 4104 times
0
Submitted by rossmccrann Deno
Verified 604 days ago
1
type Stripe = {
2
  token: string;
3
};
4
export async function main(stripe_con: Stripe, id: string) {
5
  const STRIPE_CONFIRM_PAYMENT_URL = `https://api.stripe.com/v1/payment_intents/:${id}/confirm`;
6

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

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