View Categories

Vipps Mobilepay integration #

See this guide on how to integrate Sapera with Vipps Mobilepay

Application Builder #

Make sure [Payments .basic] is enabled for the tenant (this is part of the new “Payment microservice”, which is responsible for handling payments, including Vipps payments).

Sapera integration to Vipps Mobilepay

Financial app #

Open [Financial] app.

Create Vipps incoming payment option #

Access the [Incoming Payment Options] page ({base address}/financial/app/#/incoming-payment-options) and create a new incoming payment method with [Payment type] = Vipps E-payment and [Quick access available] enabled.

Sapera integration to Vipps Mobilepay

Make sure the payment method is checked.

Sapera integration to Vipps Mobilepay

POS app #

Open [POS] app.

Create Vipps agreement #

Go to the [Vipps Agreements] page ({base address}/pos/app/#/vipps-agreements) and press the [+] button. Enter the display name of the new Vipps agreement in the editor and press the [Set API Keys] button. Then enter the API keys (client_id, client_secret and Ocp-Apim-Subscription-Key).

Then go to [Gem].

Note: API keys are stored in the db in an encrypted way, so they will not be available for the next edit, and if the user wants to change them – they must be entered again.

Setup Vipps agreement webhook #

On the [Vipps agreements] page with the selected Vipps agreement, click the [Register webhook] button.

Sapera integration to Vipps Mobilepay

Create Vipps sales unit #

Go to the [Vipps Sales Units] page ({base address}/pos/app/#/vipps-sales-units) and press the [+] button. Select the current organizational unit in the opened dialog.

Sapera integration to Vipps Mobilepay

Then the editing window opens to define the Vipps sales unit display name and selected Vipps agreement (e.g. created in previous step).

You must also enter the Merchant Serial Number on the Vipps sales unit.

Sapera integration to Vipps Mobilepay

Setting up merchant QR codes #

On the [Vipps sales units] page with the selected Vipps sales unit, click on the [Merchant callback Qrs] button.

Sapera integration to Vipps Mobilepay

Then press the [Sync with Vipps] button in the popup window to retrieve previously created webhooks from Vipps. Also in this popup it is possible to create a new Merchant callback QR or convert existing MobilePay QR to Merchant callback QR. It is also possible to view the QR image.

Sapera integration to Vipps Mobilepay

Setting up an agent profile #

Go to the [Agent Instances] page ({base address}/pos/app/#/agentInstances) and select one of the agent instances in the grid (e.g. NoAgent). Then press the button [View agent profiles].

Sapera integration to Vipps Mobilepay

Select one of the agent profiles and press the button [Rediger]. In the open window, select the Vipp sales device and one of its Merchant callback QRs.

Sapera integration to Vipps Mobilepay

Save changes and select changed agent profile for the current session.

Sapera integration to Vipps Mobilepay

Payment flow #

Payment flow will be demonstrated when creating sales.

Go to the [Nyt salg] page ({base address}/pos/app/#/new-sale) and press the [Start nyt salg] button.

Add some products to the basket.

Then press the [Vipps] button (payment option created during setup).

Sapera integration to Vipps Mobilepay

The payment screen opens. Uncheck the [E-mail faktura] checkbox (for your convenience) and press [Betal]

Sapera integration to Vipps Mobilepay

Customer identification dialog will be opened.

Sapera integration to Vipps Mobilepay

There are 2 options: enter customer phone manually or scan the merchant callback QR previously assigned to the agent profile, then the window will automatically close and payment will begin.

Then there are 2 options:

A – Unhappy flow. Before the user will authorize payment on their phone, tap the [Afbryd] button.

Sapera integration to Vipps Mobilepay

Then the payment will be interrupted.

Sapera integration to Vipps Mobilepay

B – Good flow. The customer gets push notification of payers on their phone with information: “[Lejernavn]: payment for sale [Salg-id]”. Approve payment in customer phone. Payment will be captured and completed, and if the payment amount will be enough to complete the sale – the sale will be completed automatically.

View payment event log flow #

Go to the [Salg] page ({base address}/pos/app/#/processed-sales) and press the [Se] button on the last selected sale. [Se udsalg] page will open.

Sapera integration to Vipps Mobilepay

Find the [Financial] section on the [Se salg] page and click on the [log] icon for Vipps payment

Sapera integration to Vipps Mobilepay

The Vipps E-Payment event log will be displayed

Sapera integration to Vipps Mobilepay

Refund payment flow #

On the [Se udsalg] page, click on the [Refusion] button.

Sapera integration to Vipps Mobilepay

Tap [Vælg alle] in the opened popup and then [Refund]

Sapera integration to Vipps Mobilepay

Returns will be added to the basket.

In the [mere] menu, tap on the [Refund original salgsbetaling] item.

Sapera integration to Vipps Mobilepay

On the selected popup, select the payment to refund and amount to refund, and then tap [Ok].

Sapera integration to Vipps Mobilepay

Refund payment will be registered.

Sapera integration to Vipps Mobilepay

It is possible to tap on the [log] icon to view the refund detection event log.

Sapera integration to Vipps Mobilepay

How to test Vipp's webhook locally #

For debug purposes, you may need to test the Vipp webhook locally. For that, we need to somehow expose the HTTP url to the web and register the webhook using it.

The following changes need to be made in Payments microservice app.config:

added the following key to the KeyValueSettings section: <add key=”VippsTestWebhookUrl” value=”<https://crs-vipps-webhook-test.loca.lt>” /> (value https://crs-vipps-webhook-test .loca.lt used as example);

Make sure that the setting of VippsEPaymentIsTestMode is set to “true”, otherwise the setting of VippsTestWebhookUrl will be ignored.

Must be installed globally on workstation after npm package npm:localtunnel

After starting services, launch the following command in command prompt:

lt — subdomain crs-vipps-webhook-test –port 9000

The answer will be: your url is: https://crs-vipps-webhook-test.loca.lt and then 9000 port will be accessible from the internet via url https://crs-vipps-webhook-test.loca.lt which will be enough for setting up and testing the VIPPS webhook.

NOTE: The lifetime of the local tunnel is not defined, but in my experience it is turned off every time when the debug services are stopped, so every time after restarting services the local tunnel command must be run again. d

Video demonstration

Want to share the article?