Skip to main content

Parking and "Pay-as-you-go"

Make it easier for your customers to pay for parking and other and "pay-as-you-go" services.

The solution is a combination of the Login and Recurring APIs, and makes special use of Recurring agreements with variable amount.

Parking scenario

The following illustration shows how the Recurring API can be used to charge for parking.

Paying for parking

The customer has entered an agreement that allows the parking company to charge for parking every day. They specify the total amount they are allowed to be for all parking that day.

The same solution can of course be used to charge weekly, monthly, or yearly.

Prerequisites

Generate a QR code

Generate a merchant redirect QR code with a merchant redirect QR that links to your company website.

When the customer scans the QR code, they are redirected to your website.

How to create a QR code

The QR code contains a Id that associates it with the parking location.

Here is an example HTTP POST:

POST:/qr/v1/merchant-redirect

{
"id": "company_site",
"redirectUrl": "https://example.com/myParkingCompany"
}

Webhooks for Recurring events

Register a webhook to alert you when your recurring agreement request is approved and when your charges are processed. See the Recurring API guide for more details.

What are webhooks?

When changes happen to your API request, events are triggered (for example: Reserved, Captured, Canceled, failed, Expired, and many more).

You can register to receive these events, which is useful for programming an appropriate and quick response.

The webhook will send a message to your web server at the URL you specify.

Details

Step 1: The customer scans the QR code

When customer scans the QR code, they are redirected to your website on their phone.

Step 2. The customer logs in

The customer identifies themselves by logging in with Vipps MobilePay Login.

See the Login quick start guide for a detailed example.

Step 3. Create agreement

The customer now has an account, with verified user data, and is able to both log in and pay. Send them an agreement request with a variable amount.

Detailed example

Create an agreement and specify pricing.type="VARIABLE". Set a suggestedMaxAmount. The user can modify this amount later, and that will be set in a maxAmount field.

Here is an example HTTP POST:

POST:/agreements

With body:

{
"interval": {
"unit" : "DAY",
"count": 1
},
"pricing": {
"suggestedMaxAmount": 200000,
"currency": "NOK",
"type": "VARIABLE"
},
"merchantRedirectUrl": "https://example.com/myParkingCompany",
"merchantAgreementUrl": "https://example.com/myParkingCompany/agreement-url",
"phoneNumber": "4712345678",
"productName": "Pay-as-you-go"
}

See Recurring agreements with variable amount for more information.

Step 4. Customer accepts agreement

The customer accepts the agreement in the Vipps or MobilePay app. Send them a confirmation of the subscription.

Step 5. Charge for variable amounts

Each time the customer parks their car in the area, send them an unscheduled charge.

Detailed example

Here is an example HTTP POST:

POST:/recurring/v3/agreements/{agreementId}/charges

With body:

{
"amount": 1800,
"transactionType": "DIRECT_CAPTURE",
"description": "Parking 2025-08-07.",
"retryDays": 5,
"type": "UNSCHEDULED"
}

Step 6. Attach a receipt

Attach a digital receipt for the parking session.

Detailed example

Here is an example HTTP POST:

POST:/order-management/v2/{paymentType}/receipts/{orderId}

Use recurring for recurring payments. For orderId, use the chargeId of the charge.

Body:

{
"orderLines": [
{
"name": "parking",
"id": "line_item_1",
"totalAmount": 11000,
"totalAmountExcludingTax": 8250,
"totalTaxAmount": 2750,
"taxPercentage": 25,
},
},
],
"bottomLine": {
"currency": "NOK",
"posId": "parking_lot_012"
}
}

Relevant comments

  • For parking and "pay-as-you-go" cases, we usually recommend that you set up a Recurring agreement with variable amount and daily interval.
  • You can create as many charges as you want within the interval, but we recommend that you sum up the usage over the day and create one charge for that day.
  • You need to take the maxAmount limit into account. For example, if the agreement is set to daily and maxAmount is 1000, you will not be able to create charges that bring the total to more than 1000 for that day. Remember that it is you, as the merchant, who set the suggestMaxAmount, so you can guide the users to a suitable limit.
  • If the total sum is more than maxAmount and you create a charge that is larger than maxAmount, the end user will be notified in the Vipps or MobilePay app to increase their limit for this agreement.
  • In general using the Recurring API you need to send in the charge two days before due date. However, for use cases like parking and "pay-as-you-go" we allow for creating charges that will be due the day after (for example you send in the charge at 10pm at day 0, the user will be charged in the morning of day 1). Do get access to this opportunity you need to be part of a whitelist. Contact us if this is relevant for you.

Sequence diagrams

"Pay-as-you-go" plan

Signing up for the "Pay-as-you-go" plan:

Daily charges

Daily charges, if parking was done:

Help us improve our documentation

Did you find what you were looking for?