Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
;(async () => {
try {
const response = await opennode.createCharge(charge);
console.log(response);
}
catch(error) {
console.error(`${error.status} | ${error.message}`);
}
})();
/**
* Using promises
*/
const charge = {
amount: 10.5,
currency: "USD",
callback_url: "https://example.com/webhook/opennode",
auto_settle: false
};
/**
* Using promises
*/
opennode.createCharge(charge)
.then(response => {
console.log(response);
})
.catch(error => {
console.error(`${error.status} | ${error.message}`);
});
/**
* Using async/await
*/
;(async () => {
try {
const response = await opennode.createCharge(charge);
console.log(response);
}