Last active
February 28, 2023 09:35
-
-
Save dvygolov/f60f510448cd5264c96a38d7b5a9219a to your computer and use it in GitHub Desktop.
Converts POSTPAY FB Ad Account to PREPAY
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let token = require("DTSGInitialData").token || document.querySelector('[name="fb_dtsg"]').value; | |
let uid = require("CurrentUserInitialData").USER_ID; | |
let accountId = require("BusinessUnifiedNavigationContext").adAccountID; | |
let resp = await fetch("https://business.secure.facebook.com/ajax/payment/token_proxy.php?tpe=/api/graphql/", { | |
headers: { | |
"content-type": "application/x-www-form-urlencoded" | |
}, | |
referrer: "https://www.business.facebook.com/", | |
body: `av=${uid}&payment_dev_cycle=prod&__user=${uid}&__a=1&fb_dtsg=${token}&variables={"input":{"client_mutation_id":"3","actor_id":"${uid}","logging_data":{"logging_counter":21,"logging_id":""},"payment_account_id":"${accountId}"}}&server_timestamps=true&doc_id=3138742652811181`, | |
method: "POST", | |
mode: "cors", | |
credentials: "include" | |
}); | |
let json = await resp.json(); | |
if (json.errors!=null) | |
{ | |
console.log("ERROR! Couldn't convert account to PREPAY! ☹"); | |
} | |
else{ | |
console.log("BINGO! You have a PREPAY account now! 🙃 This page will reload in 3 seconds..."); | |
setTimeout(()=>location.reload(),3000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment