Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* Setup your API Key and environment
*/
opennode.setCredentials('MY_API_KEY', 'dev');
/**
*
* Fetch charge information
*/
/**
* Using promises
*/
opennode.chargeInfo('47bb5224-bf50-49d0-a317-4adfd345221a')
.then(charge => {
console.log(charge);
})
.catch(error => {
console.error(`${error.status} | ${error.message}`);
})
/**
*
* Using async/await
*/
;(async () => {
try {
const data = await opennode.chargeInfo('47bb5224-bf50-49d0-a317-4adfd345221a');
;(async () => {
try {
const data = await opennode.chargeInfo('47bb5224-bf50-49d0-a317-4adfd345221a');
console.log(data);
}
catch (error) {
console.error(`${error.status} | ${error.message}`);
}
})()