This commit is contained in:
Kurt Hutten IrevDev
2022-08-01 14:27:11 +10:00
commit f6fe9bcaac
68 changed files with 16225 additions and 0 deletions

View File

@ -0,0 +1,21 @@
import fetch from 'node-fetch';
import { PaymentIntent_type, Error_type } from '../../models.js';
type Create_payment_intent_for_user_return = PaymentIntent_type | Error_type;
export default async function create_payment_intent_for_user(): Promise<Create_payment_intent_for_user_return> {
const url = `/user/payment/intent`;
const fullUrl = 'https://api.kittycad.io' + url;
const kittycadToken = process.env.KITTYCAD_TOKEN || '';
const headers = {
Authorization: `Bearer ${kittycadToken}`,
};
const fetchOptions = {
method: 'POST',
headers,
};
const response = await fetch(fullUrl, fetchOptions);
const result =
(await response.json()) as Create_payment_intent_for_user_return;
return result;
}