仅供参考!!! 目前是否可行可能就需要诸位佬友自行尝试了
官方支付通道
// ═══════════════════════════════════════════════════════════════
// 脚本A · ChatGPT Business 1席位 $0 套餐页获取器(内嵌页版)
// ────────────────────────────────────────────────────────────────
// 产出:chatgpt.com/checkout/... 套餐详情页(数量1 / $0.00)
// 该页面是官方支付通道,卡/PayPal 均走正常流程
// 页面与账号绑定,需登录该账号打开
//
// 原理:1席位资格(min=1)由服务端对每个新session随机分配,
// 脚本自动循环创建直到刷出资格,再降为1席
// 使用:登录 chatgpt.com → F12 → Console → 整体粘贴回车
// ═══════════════════════════════════════════════════════════════
(async function oneSeatPage() {
// ┌─────────────────────────────────────────────┐
// │ ★★★ 配置区(按需修改)★★★ │
// └─────────────────────────────────────────────┘
// 【优惠码】注意大小写;留空 "" = 不用码(原价1席 $25/月)
const COUPON = "优惠码";
// 【国家】"auto" = 自动探测出口IP;或手动 "US"/"GB"/"JP"...
const COUNTRY = "auto";
// 【刷资格次数】min=1 随机分配,一般 1~5 次内出,最多刷这么多次
const MAX_MINT_ATTEMPTS = 15;
// 【工作空间名】留空自动随机
const WORKSPACE_NAME = "";
// ══════════════ 以下勿动 ══════════════
const LINE = "─".repeat(60);
const sleep = ms => new Promise(r => setTimeout(r, ms));
console.log("⏳ 获取 Session Token ...");
let accessToken;
try {
const s = await fetch("/api/auth/session").then(r => r.json());
accessToken = s?.accessToken;
if (!accessToken) throw new Error("accessToken 为空(未登录?)");
console.log(`✅ 已登录:${s.user?.email}`);
} catch (e) { return console.error("❌ Token 获取失败:", e.message); }
const H = { Authorization: `Bearer ${accessToken}`, "Content-Type": "application/json" };
// 国家探测
let country = COUNTRY, currency = "USD";
if (country === "auto") {
try {
const trace = await fetch("/cdn-cgi/trace").then(r => r.text());
const loc = (trace.match(/^loc=(.+)$/m) || [])[1]?.trim();
if (loc) country = loc;
} catch (e) { country = "US"; }
}
try {
const cfg = await fetch(`/backend-api/checkout_pricing_config/configs/${country}`, { headers: H }).then(r => r.json());
currency = cfg?.currency_config?.symbol_code || "USD";
} catch (e) {}
console.log(`✅ 地区:${country} / ${currency}`);
// 优惠码资格
if (COUPON) {
console.log(`⏳ 检查优惠码 [${COUPON}] ...`);
try {
const el = await fetch(`/backend-api/promotions/eligibility/${COUPON}?type=promo`, { headers: H }).then(r => r.json());
if (!el.is_eligible) {
return console.error("❌ 优惠码不可用:", el.ineligible_reason,
"\n 常见原因:码抄错 / 节点地区不匹配 / 该账号已用过");
}
console.log("✅ 优惠码资格正常");
} catch (e) { console.warn("⚠️ 资格检查异常(继续):", e.message); }
}
// ══ 第一步:循环创建 session,刷 min=1 资格 ══
console.log("⏳ 开始刷 1 席位资格(服务端随机分配,循环尝试)...");
let hit = null;
for (let i = 1; i <= MAX_MINT_ATTEMPTS; i++) {
const aid = crypto.randomUUID();
const wsName = WORKSPACE_NAME || ("ws-" + aid.slice(0, 8));
let cj;
try {
const resp = await fetch("/backend-api/payments/checkout", {
method: "POST", headers: H,
body: JSON.stringify({
entry_point: "team_direct_signup",
plan_name: "chatgptteamplan",
...(COUPON ? { promo_code: COUPON } : {}),
team_plan_data: {
workspace_name: wsName, price_interval: "month",
seat_quantity: 2,
seat_quantities: [{ seat_type: "default", quantity: 2 }, { seat_type: "prolite", quantity: 0 }]
},
billing_details: { country, currency },
supports_saved_payment_link: true,
checkout_ui_mode: "custom",
checkout_appearance: "light",
cancel_url: `https://chatgpt.com/create-workspace`,
purchase_attempt_id: aid
})
});
cj = await resp.json().catch(() => null);
if (!resp.ok) {
const d = JSON.stringify(cj || {});
if (d.includes("rate_limit")) return console.error("❌ 创建被限流,过段时间再跑");
if (d.includes("unusual activity")) return console.error("❌ 账号/IP 被风控,换号或换节点");
console.log(` #${i} 创建失败 HTTP ${resp.status}:${cj?.detail}`);
await sleep(1500); continue;
}
} catch (e) { console.log(` #${i} 网络异常:${e.message}`); await sleep(1500); continue; }
const g = await fetch(`/backend-api/payments/checkout/openai_llc/${cj.checkout_session_id}?supports_business_seat_offer=true`,
{ headers: H }).then(r => r.json()).catch(() => null);
const min = g?.business_minimum_seats;
console.log(` #${i} ${cj.checkout_session_id.slice(-8)} → min=${min ?? 2}`);
if (min === 1) { hit = cj; break; }
await sleep(1200);
}
if (!hit) return console.error(`❌ ${MAX_MINT_ATTEMPTS} 次都没刷出资格,稍后再跑`);
console.log("✅ 刷到 1 席位资格 session:", hit.checkout_session_id);
// ══ 第二步:降为 1 席(竞态保护:递增延时重试)══
console.log("⏳ 降为 1 席位(服务端有竞态,自动重试)...");
await sleep(3000);
let up = null, ok = false;
const delays = [0, 5000, 8000, 12000, 15000];
for (let i = 0; i < delays.length; i++) {
if (delays[i]) { console.log(` 等待 ${delays[i] / 1000}s 后第 ${i + 1} 次尝试...`); await sleep(delays[i]); }
up = await fetch("/backend-api/payments/checkout/update", {
method: "POST", headers: H,
body: JSON.stringify({
checkout_session_id: hit.checkout_session_id,
processor_entity: hit.processor_entity || "openai_llc",
plan_name: "chatgptteamplan", price_interval: "month",
seat_quantity: 1,
seat_quantities: [{ seat_type: "default", quantity: 1 }, { seat_type: "prolite", quantity: 0 }],
...(COUPON ? { promo_code: COUPON, promo_campaign: null } : {})
})
}).then(r => r.json()).catch(() => null);
if (up?.success === true) { ok = true; break; }
console.log(` 第 ${i + 1} 次未生效:${up?.detail ?? "无响应"}`);
}
if (!ok) return console.error("❌ 降席反复失败,重跑脚本换新 session");
// ══ 输出 ══
const pageUrl = `https://chatgpt.com/checkout/openai_llc/${hit.checkout_session_id}` +
(COUPON ? `?promoCode=${COUPON}&price_interval=month&selectedPlan=month` : ``);
console.log(LINE);
console.log("✅ 1 席位套餐页生成成功!");
console.log(`📋 计划 : ChatGPT Business 月付 [${country}/${currency}]`);
console.log(`💺 席位 : 1 × Standard`);
if (COUPON) console.log(`🎟️ 优惠码 : ${COUPON}(-1席费用 × 48个月 → $0.00/月)`);
console.log(`💰 应付 : ${COUPON ? "$0.00 × 48 个月" : "原价,见页面"}`);
console.log("🔗 套餐支付页(登录本账号打开,官方通道):");
console.log(pageUrl);
console.log(LINE);
console.log("⚠️ 说明:");
console.log(" · 打开后核对页面显示「数量 1 / 今日应付 $0.00」再付款");
console.log(" · 显示数量 2 = 降席没生效,重跑脚本");
console.log(" · 页面约24h有效;支持卡/Link,被拒换卡");
})();
Stripe 托管页长链接
// ═══════════════════════════════════════════════════════════════
// 脚本B · ChatGPT Business 1席位 $0 长链接提取器(pay.openai.com 版)
// ────────────────────────────────────────────────────────────────
// 产出:pay.openai.com/c/pay/{id}#... Stripe 托管页长链接
//
// ⚠️ 重要须知(2026-11 实测结论):
// 该长链接由 custom session 手工拼装,页面可正常渲染、可填卡、
// 确认请求可发出;但服务端不支持在这条路径上完成扣款闭环,
// 提交后会无限转圈。能实际付款的是【脚本A的内嵌页】或
// 【2席位真hosted链接】。此脚本供对比测试/研究/特定环境使用。
//
// 使用:登录 chatgpt.com → F12 → Console → 整体粘贴回车
// ═══════════════════════════════════════════════════════════════
(async function oneSeatHostedLink() {
// ┌─────────────────────────────────────────────┐
// │ ★★★ 配置区(按需修改)★★★ │
// └─────────────────────────────────────────────┘
// 【优惠码】注意大小写;留空 "" = 不用码
const COUPON = "优惠码";
// 【国家】"auto" = 自动探测出口IP;或手动 "US"/"GB"/"JP"...
const COUNTRY = "auto";
// 【刷资格次数】
const MAX_MINT_ATTEMPTS = 15;
// 【工作空间名】留空自动随机
const WORKSPACE_NAME = "";
// ══════════════ 以下勿动 ══════════════
// pay.openai.com 托管页配置指纹(商户级常量;链接报 incomplete 时
// 用任意真hosted流程链接里的 #尾巴 替换此处)
const FRAGMENT = "fidnandhYHdWcXxpYCc%2FJ2FgY2RwaXEnKSdpamZkaWAnPyd%2FbScpJ3ZwZ3Zmd2x1cWxqa1BrbHRwYGtgdnZAa2RnaWBhJz9jZGl2YCknYnMnPzUpJ2R1bE5gfCc%2FJ3VuWmlsc2BaMDRNSndWckYzbTRrfUJqTDZpUURiV29cU3d%2FMWFQNmNTSmRnfEZmTlc2dWdAT2JwRlNEaXRGfWF9RlBzaldtNF1ScldkZlNsanNQNm5JTnN1bm9tMkx0blI1NWxdVHZvajZrJyknY3dqaFZgd3Ngdyc%2FcXdwYCknZ2RmbmJ3anBrYUZqaWp3Jz8nJmNjY2NjYycpJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl";
const LINE = "─".repeat(60);
const sleep = ms => new Promise(r => setTimeout(r, ms));
console.log("⏳ 获取 Session Token ...");
let accessToken;
try {
const s = await fetch("/api/auth/session").then(r => r.json());
accessToken = s?.accessToken;
if (!accessToken) throw new Error("accessToken 为空(未登录?)");
console.log(`✅ 已登录:${s.user?.email}`);
} catch (e) { return console.error("❌ Token 获取失败:", e.message); }
const H = { Authorization: `Bearer ${accessToken}`, "Content-Type": "application/json" };
let country = COUNTRY, currency = "USD";
if (country === "auto") {
try {
const trace = await fetch("/cdn-cgi/trace").then(r => r.text());
const loc = (trace.match(/^loc=(.+)$/m) || [])[1]?.trim();
if (loc) country = loc;
} catch (e) { country = "US"; }
}
try {
const cfg = await fetch(`/backend-api/checkout_pricing_config/configs/${country}`, { headers: H }).then(r => r.json());
currency = cfg?.currency_config?.symbol_code || "USD";
} catch (e) {}
console.log(`✅ 地区:${country} / ${currency}`);
if (COUPON) {
console.log(`⏳ 检查优惠码 [${COUPON}] ...`);
try {
const el = await fetch(`/backend-api/promotions/eligibility/${COUPON}?type=promo`, { headers: H }).then(r => r.json());
if (!el.is_eligible) {
return console.error("❌ 优惠码不可用:", el.ineligible_reason);
}
console.log("✅ 优惠码资格正常");
} catch (e) { console.warn("⚠️ 资格检查异常(继续):", e.message); }
}
// 刷 min=1
console.log("⏳ 刷 1 席位资格 ...");
let hit = null;
for (let i = 1; i <= MAX_MINT_ATTEMPTS; i++) {
const aid = crypto.randomUUID();
const wsName = WORKSPACE_NAME || ("ws-" + aid.slice(0, 8));
let cj;
try {
const resp = await fetch("/backend-api/payments/checkout", {
method: "POST", headers: H,
body: JSON.stringify({
entry_point: "team_direct_signup",
plan_name: "chatgptteamplan",
...(COUPON ? { promo_code: COUPON } : {}),
team_plan_data: {
workspace_name: wsName, price_interval: "month",
seat_quantity: 2,
seat_quantities: [{ seat_type: "default", quantity: 2 }, { seat_type: "prolite", quantity: 0 }]
},
billing_details: { country, currency },
supports_saved_payment_link: true,
checkout_ui_mode: "custom",
checkout_appearance: "light",
cancel_url: `https://chatgpt.com/create-workspace`,
purchase_attempt_id: aid
})
});
cj = await resp.json().catch(() => null);
if (!resp.ok) {
const d = JSON.stringify(cj || {});
if (d.includes("rate_limit")) return console.error("❌ 创建被限流,过段时间再跑");
if (d.includes("unusual activity")) return console.error("❌ 账号/IP 被风控,换号或换节点");
console.log(` #${i} 创建失败:${cj?.detail}`);
await sleep(1500); continue;
}
} catch (e) { await sleep(1500); continue; }
const g = await fetch(`/backend-api/payments/checkout/openai_llc/${cj.checkout_session_id}?supports_business_seat_offer=true`,
{ headers: H }).then(r => r.json()).catch(() => null);
console.log(` #${i} ${cj.checkout_session_id.slice(-8)} → min=${g?.business_minimum_seats ?? 2}`);
if (g?.business_minimum_seats === 1) { hit = cj; break; }
await sleep(1200);
}
if (!hit) return console.error(`❌ ${MAX_MINT_ATTEMPTS} 次没刷出资格`);
console.log("✅ 资格 session:", hit.checkout_session_id);
// 降席(竞态保护)
console.log("⏳ 降为 1 席位 ...");
await sleep(3000);
let up = null, ok = false;
const delays = [0, 5000, 8000, 12000, 15000];
for (let i = 0; i < delays.length; i++) {
if (delays[i]) await sleep(delays[i]);
up = await fetch("/backend-api/payments/checkout/update", {
method: "POST", headers: H,
body: JSON.stringify({
checkout_session_id: hit.checkout_session_id,
processor_entity: hit.processor_entity || "openai_llc",
plan_name: "chatgptteamplan", price_interval: "month",
seat_quantity: 1,
seat_quantities: [{ seat_type: "default", quantity: 1 }, { seat_type: "prolite", quantity: 0 }],
...(COUPON ? { promo_code: COUPON, promo_campaign: null } : {})
})
}).then(r => r.json()).catch(() => null);
if (up?.success === true) { ok = true; break; }
console.log(` 第 ${i + 1} 次未生效,继续重试 ...`);
}
if (!ok) return console.error("❌ 降席失败,重跑脚本");
const hostedUrl = `https://pay.openai.com/c/pay/${hit.checkout_session_id}#${FRAGMENT}`;
console.log(LINE);
console.log("✅ 1 席位长链接生成成功!");
console.log(`💺 席位 : 1 × Standard | ${COUPON ? "$0.00/月 × 48个月" : "原价"}`);
console.log(`🆔 ${hit.checkout_session_id}`);
console.log("🔗 Stripe 托管长链接(完整复制,含 # 尾巴):");
console.log(hostedUrl);
console.log(LINE);
})();
长链接目前是否可用未知(没有多余优惠码了 还没测试) 想研究的可以参考一下
48Team 2席位(及以上)长链接
(async function generateAUTeamLink() {
// ================= 配置项 =================
const WORKSPACE_NAME = "xxx";
const COUPON = "优惠码"; // 优惠码
const EXISTING_WORKSPACE_ID = ""; // 留空则新建空间
const SEAT_QUANTITY = 2; // 席位数量(Team 最少 2 个)
const AUTO_OPEN_CHECKOUT = false;
// ==========================================
if (window.location.origin !== "https://chatgpt.com") {
throw new Error(`请在 https://chatgpt.com 页面执行脚本,当前来源为 ${window.location.origin}`);
}
console.log("⏳ 正在获取 ChatGPT Session Token...");
// 1. 自动获取登录凭证
let accessToken;
try {
const s = await fetch("/api/auth/session", { credentials: "include" }).then(r => r.json());
accessToken = s?.accessToken;
if (!accessToken) throw new Error("accessToken 为空,请确认已登录 ChatGPT 账号");
const currentAccount = s.account || {};
const currentPlan = currentAccount.planType || currentAccount.plan_type;
const currentStructure = currentAccount.structure;
if (currentPlan !== "free" || currentStructure !== "personal") {
throw new Error("当前选中的不是 Personal/Free 个人账户,请先切换个人账户后重试");
}
} catch (e) {
console.error("❌ 获取 Token 失败:", e.message);
return;
}
console.log("✅ Token 获取成功");
// 2. 构建请求 Payload
const payload = {
plan_name: "chatgptteamplan",
team_plan_data: {
workspace_name: WORKSPACE_NAME,
price_interval: "month", // month 或 year
seat_quantity: SEAT_QUANTITY,
...(EXISTING_WORKSPACE_ID ? { existing_workspace_id: EXISTING_WORKSPACE_ID } : {})
},
billing_details: {
country: "US",
currency: "EGP"
},
cancel_url: "https://chatgpt.com/?promoCode=%E4%BC%98%E6%83%A0%E7%A0%81",
promo_code: COUPON,
checkout_ui_mode: "hosted"
};
// 3. 请求 Stripe 长链接
console.log("⏳ 正在请求 Stripe 支付长链接...");
try {
const resp = await fetch(
"/backend-api/payments/checkout",
{
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json"
},
credentials: "same-origin",
body: JSON.stringify(payload)
}
);
const data = await resp.json();
if (!resp.ok) {
console.error(`❌ 请求失败 HTTP ${resp.status}`);
console.log("📋 响应详情:", data);
return;
}
const hostedUrl = data?.url || data?.stripe_hosted_url || data?.checkout_url;
if (!hostedUrl) {
console.warn("⚠️ 未找到长链接,原始响应:", data);
return;
}
const checkoutUrl = new URL(hostedUrl);
if (checkoutUrl.protocol !== "https:") {
throw new Error("服务端返回了无效的支付链接");
}
// 4. 打印结果
console.log("─".repeat(60));
console.log("✅ ChatGPT Team 链接生成成功!");
console.log(`📌 工作区名称 : ${payload.team_plan_data.workspace_name}`);
console.log(`💺 席位数量 : ${payload.team_plan_data.seat_quantity}`);
console.log(`🎟️ 优惠码 : ${COUPON}`);
console.log(`🌍 地区/货币 : ${payload.billing_details.country} (${payload.billing_details.currency})`);
if (data.checkout_session_id) {
console.log(`🆔 Session ID : ${data.checkout_session_id}`);
}
console.log("─".repeat(60));
console.log("🔗 Stripe 支付长链接(复制到浏览器打开):");
console.log(checkoutUrl.href);
console.log("─".repeat(60));
if (AUTO_OPEN_CHECKOUT) {
window.open(checkoutUrl.href, "_blank", "noopener,noreferrer");
}
} catch (e) {
console.error("❌ 网络异常或请求失败:", e.message);
}
})();
4
5
5 respuestas
Orden