midtrans-nodejs-client icon indicating copy to clipboard operation
midtrans-nodejs-client copied to clipboard

How to override webhook url using library?

Open AhmetHuseyinDOK opened this issue 1 year ago • 1 comments

In the Midtrans documentation, it is shown that we can override the webhook url via headers, How can I achieve the same result using this library ?

https://docs.midtrans.com/docs/https-notification-webhooks#customizing-notification-url-via-api

AhmetHuseyinDOK avatar May 15 '24 03:05 AhmetHuseyinDOK

Ok I found a workaround,

this.snapApi.httpClient.http_client.defaults.headers.common['X-Override-Notification'] = "https://somewebhook.com/handler/ ";

But I think, it would be nice to be able to do it with an optional config like this

this.snapApi.createTransaction({
            transaction_details: {
                gross_amount: transaction.amount,
                order_id: transaction.id,
            },
            enabled_payments: ['gopay'],
            overrideNotification: 'https://somenotificatipon.com/webhookhandler/' // would be much nicer
        })

AhmetHuseyinDOK avatar May 15 '24 03:05 AhmetHuseyinDOK