-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.js
28 lines (23 loc) · 933 Bytes
/
delete.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require('dotenv').config();
const users = require('./bin/users.json');
// const { initializeApp } = require('firebase-admin/app');
const revenueCatApiKey = process.env.REVENUECAT_API_KEY;
const axios = require('axios');
// const { app } = require('firebase-admin');
users.forEach(getEmail);
async function getEmail (user) {
let app_user_id = user.app_user_id;
const revenueCatApiKey = process.env.REVENUECAT_API_KEY;
const revenueCatApiUrl = `https://api.revenuecat.com/v1/subscribers/${app_user_id}`;
const revenueCatHeaders = {
'Content-Type': 'application/json',
'Authorization': `Bearer ${revenueCatApiKey}`,
};
const response = axios.delete(revenueCatApiUrl, { headers: revenueCatHeaders })
.then(response => {
console.log(`RevenueCat subscriber ${app_user_id} deleted.`);
})
.catch(error => {
console.log(`Error: Unable to delete subscriber ${app_user_id}`, error);
});
}