Testing Vipps Webhooks Locally
For debugging purposes, it may be necessary to test the Vipps webhook locally. To do this, you need to expose a local HTTP endpoint to the internet and register a webhook that points to it.
Configuration Changes
Update the app.config
file in the Payments microservice with the following:
1. Add a test webhook URL
In the KeyValueSettings
section, add:
<add key="VippsTestWebhookUrl" value="https://crs-vipps-webhook-test.loca.lt" />
The URL https://crs-vipps-webhook-test.loca.lt
is used as an example.
2. Enable test mode
Ensure the setting VippsEPaymentIsTestMode
is set to "true"
. If this setting is disabled, the VippsTestWebhookUrl
will be ignored.
Setting Up a Local Tunnel
Install the localtunnel npm package globally:
npm install -g localtunnel
Once your services are running, open a command prompt and execute:
lt --subdomain crs-vipps-webhook-test --port 9000
You should receive output like:
your url is: https://crs-vipps-webhook-test.loca.lt
This exposes your local port 9000
to the internet via the given URL, which can now be used to test and configure the Vipps webhook.
The lifetime of the local tunnel is not guaranteed. In most cases, it will terminate when local debug services are stopped. Therefore, you must restart the localtunnel
command every time you restart your local environment.