I am working on a Meteor app which is a framework on top of nodeJs.
So far I could get a token which type is Bearer and scope is identity.
My patreon creator page is https://www.patreon.com/MassEducationWeapon
With that token I call the following endpoint:
https://www.patreon.com/api/oauth2/api/current_user
Is the following correct? Assuming that I only have one tier:
const url = 'https://www.patreon.com/api/oauth2/api/current_user';
const options = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Bearer ' + access_token
}
};
HTTP.call('GET', url, options, function(error, response) {
if (!error) {
const patreonUser = JSON.parse(response.content);
return Meteor.users.update({_id: userId},
{
$set: {
patronStatus: patreonUser.included[0].attributes.patron_status || null,
patreonLastChargeDate: patreonUser.included[0].attributes.last_charge_date || null,
patreonLastChargeStatus: patreonUser.included[0].attributes.last_charge_status || null
}
});
}
});
I mean, will patreonUser.included[0].attributes.patron_status be ‘active_patron’ if the user has paid?
I guess, I don’t have a way to check until I get my first patreon.
I guess I am not getting the following 3 fields in the api response because they are null:
patron_status
last_charge_date
last_charge_status
I will get those fields for patrons that are actually paying.