sku

Hello, I have a small issue with an event. I would like an event to occur in a chat room on my server when a user takes a user SKU, but I can't seem to get my code to work. No matter what I do, I get a 404 error. I already have this:
const skuConfig = {
"1419256664783327252": { name: "First Hour Supporter", roleId: "1419245835610488984" },
"1419256794445906040": { name: "Second Hour Supporter", roleId: "1419245846603759688" }
};

async function getOAuthToken(clientId, clientSecret) {
try {
const params = new URLSearchParams();
params.append("grant_type", "client_credentials");
params.append("scope", "applications.store.update"); // scope requis

const res = await axios.post(
"https://discord.com/api/v10/oauth2/token",
params,
{ auth: { username: clientId, password: clientSecret } }
);
return res.data.access_token;
} catch (err) {
console.error(":x: Erreur OAuth2:", err.response?.data || err.message);
return null;
}
}

async function getSubscriptions(clientId, oauthToken) {
try {
const res = await axios.get(
`https://discord.com/api/v10/applications/${clientId}/subscriptions`,
{ headers: { Authorization: `Bearer ${oauthToken}` } }
);
return res.data;
} catch (err) {
console.error(":x: Erreur récupération abonnements:", err.response?.data || err.message);
return [];
}
}
const skuConfig = {
"1419256664783327252": { name: "First Hour Supporter", roleId: "1419245835610488984" },
"1419256794445906040": { name: "Second Hour Supporter", roleId: "1419245846603759688" }
};

async function getOAuthToken(clientId, clientSecret) {
try {
const params = new URLSearchParams();
params.append("grant_type", "client_credentials");
params.append("scope", "applications.store.update"); // scope requis

const res = await axios.post(
"https://discord.com/api/v10/oauth2/token",
params,
{ auth: { username: clientId, password: clientSecret } }
);
return res.data.access_token;
} catch (err) {
console.error(":x: Erreur OAuth2:", err.response?.data || err.message);
return null;
}
}

async function getSubscriptions(clientId, oauthToken) {
try {
const res = await axios.get(
`https://discord.com/api/v10/applications/${clientId}/subscriptions`,
{ headers: { Authorization: `Bearer ${oauthToken}` } }
);
return res.data;
} catch (err) {
console.error(":x: Erreur récupération abonnements:", err.response?.data || err.message);
return [];
}
}
I wonder if, apart from webhook endpoints, I could still retrieve and embed a thank you message for user SKU purchases on my server directly in my code?
3 Replies
d.js toolkit
d.js toolkit•2w ago
Unknown User
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
d.js toolkit
d.js toolkit•2w ago
The issue has been marked as solved by support staff

Did you find this page helpful?