GPT plus 最新 0 元试用焚决方法(成本 3 元左右,强行先绑卡再支付!)
2026-08-01 22:57 依旧有效
Latest $0 ChatGPT Plus Free Trial Exploit (Costs ~3 RMB: Force Card Binding Before Payment!)
直卡焚决(1).docx (607.9 KB)
(async () => {
'use strict';
const old = document.getElementById('__personal_card_stripe_modal__');
if (old) old.remove();
// Stripe publishable key 是前端公开配置。优先从当前页面资源自动发现,
// 个人账单目前存在两个 Stripe 商户分片;SetupIntent 只能由所属
// 分片的 publishable key 确认。
const KNOWN_PUBLISHABLE_KEYS = {
KslHRdbaPg: 'pk_live_51Pj377KslHRdbaPgTJYjThzH3f5dt1N1vK7LUp0qh0yNSarhfZ6nfbG7FFlh8KLxVkvdMWN5o6Mc4Vda6NHaSnaV00C2Sbl8Zs',
C6h1nxGoI3: 'pk_live_51HOrSwC6h1nxGoI3lTAgRjYVrz4dU3fVOabyCcKR3pbEJguCVAlqCxdxCUvoRh1XWwRacViovU3kLKvpkjh7IqkW00iXQsjo3n'
};
async function discoverPublishableKey() {
const pattern = /pk_(?:live|test)_[A-Za-z0-9]{20,}/;
// 已发起过 Stripe 请求时,可直接从 Resource Timing URL 中读取 key 参数。
for (const entry of performance.getEntriesByType('resource')) {
const match = String(entry.name || '').match(pattern);
if (match) return match[0];
}
// 查找当前文档中的内联配置和 script URL。
const htmlMatch = document.documentElement.innerHTML.match(pattern);
if (htmlMatch) return htmlMatch[0];
// 尝试扫描已加载的同源 JS chunk;跨域失败会被跳过。
const scripts = [...document.scripts]
.map((script) => script.src)
.filter(Boolean)
.slice(-80);
for (const src of scripts) {
try {
const url = new URL(src, location.href);
if (url.origin !== location.origin) continue;
const body = await fetch(url, { credentials: 'include' }).then((r) => r.text());
const match = body.match(pattern);
if (match) return match[0];
} catch (_) {
// 继续尝试其他 chunk。
}
}
return KNOWN_PUBLISHABLE_KEYS.C6h1nxGoI3;
}
async function resolveStripeForIntent(clientSecret, discoveredKey) {
const hinted = Object.entries(KNOWN_PUBLISHABLE_KEYS)
.filter(([fragment]) => String(clientSecret || '').includes(fragment))
.map(([, key]) => key);
const candidates = [
...hinted,
discoveredKey,
...Object.values(KNOWN_PUBLISHABLE_KEYS)
].filter((key, index, all) => key && all.indexOf(key) === index);
let lastError = null;
for (const key of candidates) {
const candidate = window.Stripe(key);
const probe = await candidate.retrieveSetupIntent(clientSecret);
if (probe.setupIntent) return { stripe: candidate, publishableKey: key };
lastError = probe.error || lastError;
}
throw lastError || new Error('没有匹配当前 SetupIntent 的 Stripe 公钥');
}
const sessionResponse = await fetch('/api/auth/session', {
credentials: 'include',
cache: 'no-store'
});
if (!sessionResponse.ok) {
console.error('[绑卡] 当前会话读取失败:', sessionResponse.status);
return;
}
const session = await sessionResponse.json();
const accountId = session?.account?.id;
const accessToken = session?.accessToken;
if (!accountId || !accessToken) {
console.error('[绑卡] 当前会话缺少账户或访问令牌。');
return;
}
const commonHeaders = {
authorization: `Bearer ${accessToken}`,
'chatgpt-account-id': accountId
};
// 每次重新创建 Intent,避免使用已经输出或分享过的 client_secret。
const intentResponse = await fetch('/backend-api/payments/payment_method', {
method: 'POST',
credentials: 'include',
headers: {
...commonHeaders,
'content-type': 'application/json',
'x-openai-target-path': '/backend-api/payments/payment_method',
'x-openai-target-route': '/backend-api/payments/payment_method'
},
body: JSON.stringify({ account_id: accountId })
});
const intentData = await intentResponse.json().catch(() => ({}));
if (!intentResponse.ok || !intentData.client_secret) {
console.error('[绑卡] SetupIntent 创建失败:', intentResponse.status, intentData);
return;
}
const clientSecret = intentData.client_secret;
const discoveredPublishableKey = await discoverPublishableKey();
if (!window.Stripe) {
await new Promise((resolve, reject) => {
const script = document.createElement('script');
script.src = 'https://js.stripe.com/v3/';
script.async = true;
script.onload = resolve;
script.onerror = () => reject(new Error('Stripe.js 加载失败'));
document.head.appendChild(script);
});
}
const { stripe, publishableKey } = await resolveStripeForIntent(
clientSecret,
discoveredPublishableKey
);
console.log('[绑卡] Stripe 公钥已通过 SetupIntent 只读校验自动匹配。');
const overlay = document.createElement('div');
overlay.id = '__personal_card_stripe_modal__';
overlay.style.cssText = [
'position:fixed', 'inset:0', 'z-index:2147483647',
'display:flex', 'align-items:center', 'justify-content:center',
'background:rgba(15,23,42,.62)', 'padding:18px'
].join(';');
const modal = document.createElement('div');
modal.style.cssText = [
'width:min(560px,96vw)', 'max-height:92vh', 'overflow:auto',
'background:#fff', 'border-radius:14px', 'padding:20px',
'box-shadow:0 24px 70px rgba(0,0,0,.35)',
'font:14px/1.45 system-ui,-apple-system,Segoe UI,sans-serif',
'color:#0f172a'
].join(';');
modal.innerHTML = `
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px">
<strong style="font-size:18px">个人账户添加支付方式</strong>
<button id="__card_close__" type="button" style="border:0;background:#eee;border-radius:7px;padding:6px 10px;cursor:pointer">关闭</button>
</div>
<div style="font-size:12px;color:#64748b;margin-bottom:13px">
卡号、有效期、CVC 和邮编由 Stripe Card Element 收集。
</div>
<label style="display:block;font-size:12px;font-weight:600;margin-bottom:5px">持卡人姓名</label>
<input id="__card_name__" autocomplete="cc-name" style="box-sizing:border-box;width:100%;border:1px solid #d1d5db;border-radius:8px;padding:11px;margin-bottom:12px;font:14px system-ui" />
<div id="__card_element__" style="border:1px solid #d1d5db;border-radius:8px;padding:13px;background:#fff"></div>
<div id="__card_message__" style="min-height:22px;margin-top:12px;color:#b42318"></div>
<button id="__card_submit__" type="button" style="width:100%;margin-top:8px;border:0;border-radius:9px;padding:11px;background:#0f766e;color:#fff;font-weight:700;cursor:pointer">
确认绑定
</button>
`;
overlay.appendChild(modal);
(document.body || document.documentElement).appendChild(overlay);
const closeButton = modal.querySelector('#__card_close__');
const submitButton = modal.querySelector('#__card_submit__');
const cardName = modal.querySelector('#__card_name__');
const message = modal.querySelector('#__card_message__');
closeButton.onclick = () => overlay.remove();
submitButton.disabled = true;
submitButton.style.opacity = '.55';
submitButton.textContent = '等待卡输入框加载';
let cardReady = false;
let resolveCardReady;
const cardReadyPromise = new Promise((resolve) => {
resolveCardReady = resolve;
});
const elements = stripe.elements({ locale: 'zh' });
const cardElement = elements.create('card', {
hidePostalCode: false,
style: {
base: {
color: '#0f172a',
fontFamily: 'system-ui, -apple-system, Segoe UI, sans-serif',
fontSize: '16px',
'::placeholder': { color: '#94a3b8' }
},
invalid: { color: '#b42318' }
}
});
cardElement.mount('#__card_element__');
cardElement.on('ready', () => {
cardReady = true;
resolveCardReady(true);
message.style.color = '#087443';
message.textContent = '卡输入框已加载。';
submitButton.disabled = false;
submitButton.style.opacity = '1';
submitButton.textContent = '确认绑定';
});
cardElement.on('loaderror', (event) => {
cardReady = false;
resolveCardReady(false);
message.style.color = '#b42318';
message.textContent = `Stripe 输入框加载失败:${event?.error?.message || 'loaderror'}`;
console.error('[绑卡] Card Element loaderror:', event);
});
cardElement.on('change', (event) => {
if (event.error) {
message.style.color = '#b42318';
message.textContent = event.error.message;
} else if (event.complete) {
message.style.color = '#087443';
message.textContent = '卡资料填写完成,可以确认绑定。';
} else {
message.textContent = '';
}
});
submitButton.onclick = async () => {
submitButton.disabled = true;
submitButton.style.opacity = '.65';
message.style.color = '#334155';
message.textContent = '正在验证并绑定……';
try {
if (!cardReady) {
const ready = await Promise.race([
cardReadyPromise,
new Promise((resolve) => setTimeout(() => resolve(false), 15000))
]);
if (!ready || !cardReady) {
throw new Error('Stripe Card Element 尚未 ready;检查 js.stripe.com iframe 是否被浏览器扩展或跟踪保护拦截。');
}
}
const name = cardName.value.trim();
if (!name) throw new Error('请输入持卡人姓名。');
const result = await stripe.confirmCardSetup(clientSecret, {
payment_method: {
card: cardElement,
billing_details: { name },
// 与原始 ChatGPT/Stripe Payment Element 请求保持一致,
// 允许后续 Checkout/Payment Element 再次展示此支付方式。
allow_redisplay: 'always'
},
// Stripe/ChatGPT 当前前端确认链路支持该参数;成功后同时设为 Customer 默认卡。
set_as_default_payment_method: true
});
if (result.error) throw result.error;
if (result.setupIntent?.status !== 'succeeded') {
message.style.color = '#b45309';
message.textContent = `当前状态:${result.setupIntent?.status || 'unknown'}`;
return;
}
const listResponse = await fetch(
`/backend-api/payments/payment_methods?account_id=${encodeURIComponent(accountId)}`,
{
credentials: 'include',
headers: {
...commonHeaders,
'x-openai-target-path': '/backend-api/payments/payment_methods',
'x-openai-target-route': '/backend-api/payments/payment_methods'
}
}
);
const list = await listResponse.json().catch(() => ({}));
const cards = (list.payment_methods || []).map((item) => ({
brand: item.card?.brand || item.type,
last4: item.card?.last4 || '',
exp: item.card ? `${item.card.exp_month}/${item.card.exp_year}` : '',
default: item.id === list.default_payment_method_id
}));
message.style.color = '#087443';
message.textContent = '绑定成功,支付方式列表已刷新。';
console.table(cards);
submitButton.textContent = '绑定成功';
} catch (error) {
message.style.color = '#b42318';
message.textContent = error?.message || String(error);
console.error('[绑卡] Stripe 确认失败:', error);
} finally {
submitButton.disabled = false;
submitButton.style.opacity = '1';
}
};
})();


