1var webhook_json = {
2 url: 'https://f615ef32.ngrok.io',
3 event_types: [{
4 name: 'PAYMENT.SALE.COMPLETED'
5 },{
6 name: 'PAYMENT.SALE.DENIED'
7 }]
8};
9
10paypal.notification.webhook.create(webhook_json, function (error, webhook) {
11 if (error) {
12 console.error(JSON.stringify(error.response));
13 throw error;
14 } else {
15 console.log('Create webhook Response');
16 console.log(webhook);
17 }
18});