1
Create a Customer
One script reply has been approved by the moderators Verified

Create a customer. [See the docs (https://stripe.com/docs/api/customers/create) for more information

Created by rossmccrann 604 days ago Viewed 4157 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) {
5
  const STRIPE_CREATE_CUSTOMER_URL = `https://api.stripe.com/v1/customers`;
6

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

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