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.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/api/v2/purchases/student-pay-transfer.tsx
Views: 687
1
import getAccountId from "lib/account/get-account";
2
import { studentPayTransfer } from "@cocalc/server/purchases/student-pay";
3
import getParams from "lib/api/get-params";
4
5
export default async function handle(req, res) {
6
try {
7
res.json(await get(req));
8
} catch (err) {
9
res.json({ error: `${err.message}` });
10
return;
11
}
12
}
13
14
async function get(req) {
15
const account_id = await getAccountId(req);
16
if (account_id == null) {
17
throw Error("must be signed in");
18
}
19
const { project_id, paid_project_id } = getParams(req);
20
await studentPayTransfer({
21
account_id,
22
project_id,
23
paid_project_id,
24
});
25
return {};
26
}
27
28