📖
Basic Usage
Complete guide on how to use buymeacoffee.js to your project.
First get your personal access token here, then create a coffee.json file and save your personal access token inside. Example below.
coffee.json
1
{
2
"token":"access_token_here"
3
}
Copied!
After that, create your JavaScript file. Example below.
index.js
1
const BMC = require('buymeacoffee.js'); // add BMC package
2
const access = require('./coffee.json'); // load your token
3
const coffee = new BMC(access.token); // add your token here
4
5
// retrieve supporters data
6
coffee.Supporters().then(data => console.log(data));
7
8
// retrieve subscribers data
9
coffee.Subscriptions().then(data => console.log(data));
10
11
// retrieve extras data
12
coffee.Extras().then(data => console.log(data));
Copied!
You can play with the data and get specific information such as supporter name. Example below.
1
coffee.Supporters().then(data => {
2
data = data.data[0].supporter_name;
3
console.log(data);
4
});
Copied!
We will add more features to the API interactions. If you have in mind, please let us know by submitting an issue here.
Copy link