CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/api/v2/purchases/stripe/process-payment-intents.ts
Views: 791
1
import getAccountId from "lib/account/get-account";
2
import processPaymentIntents from "@cocalc/server/purchases/stripe/process-payment-intents";
3
4
export default async function handle(req, res) {
5
try {
6
res.json(await get(req));
7
} catch (err) {
8
res.json({ error: `${err.message}` });
9
return;
10
}
11
}
12
13
async function get(req) {
14
const account_id = await getAccountId(req);
15
if (account_id == null) {
16
throw Error("must be signed in");
17
}
18
return { count: await processPaymentIntents({ account_id }), success: true };
19
}
20
21