forked from xendit/xendit-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayout.js
More file actions
29 lines (24 loc) · 789 Bytes
/
Copy pathpayout.js
File metadata and controls
29 lines (24 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const x = require('../xendit');
const { Payout } = x;
const p = new Payout({});
(async function() {
try {
const payout = await p.createPayout({
externalID: Date.now().toString(),
amount: 10000,
email: 'stanley@xendit.co',
});
console.log('created payout:', payout); // eslint-disable-line no-console
const { id } = payout;
const retrievedPayout = await p.getPayout({ id });
// eslint-disable-next-line no-console
console.log('retrieved payout:', retrievedPayout);
const voidedPayout = await p.voidPayout({ id });
// eslint-disable-next-line no-console
console.log('payout voided:', voidedPayout.id);
process.exit(0);
} catch (e) {
console.error(e); // eslint-disable-line no-console
process.exit(1);
}
})();