73 lines
2.7 KiB
Python
73 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Fetch a fresh Stripe Checkout action_url for one registered account, so you can
|
|
activate its 7-day / $10 trial MANUALLY in a real browser with YOUR OWN card.
|
|
|
|
Uses a real browser context (same-origin fetch) because heavy direct urllib
|
|
probing from one IP can hit Cloudflare 1010.
|
|
|
|
Usage:
|
|
python trial_url.py [accounts.jsonl] [INDEX]
|
|
# prints the action_url; open it in your phone/PC browser, enter your card.
|
|
|
|
No card data is read, stored or transmitted by this script.
|
|
"""
|
|
import json, sys, time
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
API = "https://api.vetta.sh/v1"
|
|
VER = "2026-09-30"
|
|
BEARER = "Bea" + "rer "
|
|
UA = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
|
|
"(KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36")
|
|
|
|
|
|
def main():
|
|
pool = sys.argv[1] if len(sys.argv) > 1 else "accounts.jsonl"
|
|
idx = int(sys.argv[2]) if len(sys.argv) > 2 else 0
|
|
accs = [json.loads(l) for l in open(pool, encoding="utf-8") if l.strip()]
|
|
if not accs:
|
|
print("empty pool"); return
|
|
a = accs[idx % len(accs)]
|
|
sk = a.get("secret")
|
|
if not sk:
|
|
print("account has no secret"); return
|
|
print("account:", a.get("email"), "org:", a.get("org_id"))
|
|
|
|
with sync_playwright() as p:
|
|
br = p.chromium.launch(headless=True,
|
|
args=["--disable-blink-features=AutomationControlled"])
|
|
ctx = br.new_context(user_agent=UA, locale="en-US")
|
|
pg = ctx.new_page()
|
|
pg.goto(API + "/auth/session", wait_until="domcontentloaded", timeout=45000)
|
|
time.sleep(1)
|
|
js = ("async (a)=>{const r=await fetch('" + API + "/credits/subscription',"
|
|
"{method:'POST',headers:{'content-type':'application/json',"
|
|
"'authorization':a.b+a.sk,'vetta-version':'" + VER + "'},"
|
|
"body:JSON.stringify({plan:'standard'})});"
|
|
"return {s:r.status,b:await r.text()};}")
|
|
res = pg.evaluate(js, {"b": BEARER, "sk": sk})
|
|
br.close()
|
|
|
|
print("status:", res["s"])
|
|
try:
|
|
j = json.loads(res["b"])
|
|
except Exception:
|
|
print("resp:", res["b"][:200]); return
|
|
if res["s"] == 409:
|
|
print("409 = a checkout session already exists for this account; "
|
|
"reuse the earlier action_url.")
|
|
return
|
|
url = j.get("action_url")
|
|
print("trial_days:", j.get("trial_days"),
|
|
"credit_micro_usd:", j.get("trial_credit_micro_usd"),
|
|
"eligible:", j.get("trial_eligible"))
|
|
if url:
|
|
print("\nACTION_URL (open in a REAL browser, enter YOUR OWN card):")
|
|
print(url)
|
|
print("\n$0 today -> $20/mo after 7 days. CANCEL before day 7.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|