milauth
v1.0.1
Published
Full documentation: [api.milacoins.com](https://api.milacoins.com)
Downloads
22
Readme
MilaCoins API
Full documentation: api.milacoins.com
Sample Usage
const apiKey = process.env.MILACOINS_API_KEY;
const secretKey = process.env.MILACOINS_SECRET_KEY;
const url = "https://api.milacoins.com";
const milauth = require("milauth")(url, apiKey, secretKey);
Set the Environment (url)
- SandBox : https://sandbox-api.milacoins.com
- Production: https://api.milacoins.com
Configure Your Credentials
- Go to MilaCoins Dashboard( production, sandbox)
- Navigate to api settings
- Generate the api keys
- add IP to the white list
Request Method
milauth.request(endpoint<String>,{method:<String>[default: 'GET'], query<Object>, body:<Object>})
Request Example
try {
const invoices = await milauth.request("/api/v1/transactions/invoices/", {
query: { limit: 1 },
});
console.log(invoices);
} catch (err) {
console.log(err);
}
OR
milauth
.request("/api/v1/transactions/invoices/", { query: { limit: 1 } })
.then((res) => console.log(res))
.catch((err) => console.error(err));
API Errors
Any response status > 399 will throw Error. Error properties:
- requestID : string
- code: number
- message: string
- name: string
Full errors list: click here