1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| (async function () { try { const t = await (await fetch("/api/auth/session")).json();
if (!t.accessToken) { alert("请先登录 ChatGPT!"); return; }
const p = { plan_name: "chatgptteamplan", team_plan_data: { workspace_name: "XYe", price_interval: "month", seat_quantity: 5, }, promo_campaign: { promo_campaign_id: "team-1-month-free", is_coupon_from_query_param: true, }, checkout_ui_mode: "custom", };
const r = await fetch("https://chatgpt.com/backend-api/payments/checkout", { method: "POST", headers: { Authorization: "Bearer " + t.accessToken, "Content-Type": "application/json", }, body: JSON.stringify(p), });
const d = await r.json(); if (d.checkout_session_id) { window.location.href = "https://chatgpt.com/checkout/openai_llc/" + d.checkout_session_id; } else { alert("提取失败:" + (d.detail || JSON.stringify(d))); } } catch (e) { alert("发生错误:" + e); } })();
|