Skip to main content

Quick start

Before you begin

This document covers the quick steps for getting started with the ePayment API. You must have already signed up as an organization with Vipps MobilePay and have your test credentials from the merchant portal, as described in the Getting started guide.

Important: The examples use standard example values that you must change to use your values. This includes API keys, HTTP headers, reference, etc.

Prerequisites

Step 1 - Setup

No setup needed :)

Step 2 - Authentication

Get an access_token from the Access token API: POST:/accesstoken/get.

curl https://apitest.vipps.no/accessToken/get \
-H "client_id: YOUR-CLIENT-ID" \
-H "client_secret: YOUR-CLIENT-SECRET" \
-H "Ocp-Apim-Subscription-Key: YOUR-SUBSCRIPTION-KEY" \
-H "Merchant-Serial-Number: 123456" \
-H "Vipps-System-Name: acme" \
-H "Vipps-System-Version: 3.1.2" \
-H "Vipps-System-Plugin-Name: acme-webshop" \
-H "Vipps-System-Plugin-Version: 4.5.6" \
-X POST \
--data ''

The property access_token should be used for all other API requests in the Authorization header as the Bearer token.

Merchant Redirect QR

A merchant redirect QR contains a link to your webshop. When the user scans this with their phone, your website will open.

QR code

Generate a merchant redirect QR with: POST:/qr/v1/merchant-redirect.

curl https://apitest.vipps.no/qr/v1/merchant-redirect \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni <truncated>" \
-H "Ocp-Apim-Subscription-Key: 0f14ebcab0ec4b29ae0cb90d91b4a84a" \
-H "Merchant-Serial-Number: 123456" \
-H "Vipps-System-Name: acme" \
-H "Vipps-System-Version: 3.1.2" \
-H "Vipps-System-Plugin-Name: acme-webshop" \
-H "Vipps-System-Plugin-Version: 4.5.6" \
-H "Idempotency-Key: 49ca711a-acee-4d01-993b-9487112e1def" \
-X POST \
-d '{
"redirectUrl": "https://example.com/mywebshop",
"id": "UNIQUE-QR-ID"
}'

Enter the returned link into a browser. It will show the QR code. Scanning the QR should open the specified URL on your phone.

The result from this request provides a URL with its own JWT token, which will expire. Get a new token by calling GET:/qr/v1/merchant-redirect/{qr-id}.

Relevant examples:

One-time payment QR

A one-time payment QR (also called dynamic QR) is connected to a payment. When the user scans this QR with their phone, the Vipps app will open and present them with the payment request.

If you are using the ePayment API in your solution, you do not need to use the QR API. See Dynamic QR directing to the app for payment for an example.

Legacy method for eCom API

Create a payment and get the unique payment reference.

curl --location 'https://apitest.vipps.no/ecomm/v2/payments/' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni <truncated>" \
-H "Ocp-Apim-Subscription-Key: 0f14ebcab0ec4b29ae0cb90d91b4a84a" \
-H "Merchant-Serial-Number: 123456" \
-H "Vipps-System-Name: acme" \
-H "Vipps-System-Version: 3.1.2" \
-H "Vipps-System-Plugin-Name: acme-webshop" \
-H "Vipps-System-Plugin-Version: 4.5.6" \
-X POST \
-d '{
"customerInfo": {
"mobileNumber": "91234567"
},
"merchantInfo": {
"merchantSerialNumber": "123456",
"callbackPrefix":"https://example.com/vipps/callbacks-for-payment-update-from-vipps",
"fallBack": "https://example.com/vipps/fallback-result-page-for-both-success-and-failure/acme-shop-123-order123abc",
},
"transaction": {
"amount": 49900,
"orderId": "UNIQUE-PAYMENT-REFERENCE",
"transactionText": "One pair of socks.",
}
}'

Note that orderId must be unique for each payment you create.

Take note of the URL that is returned in the response body and provide it in the POST:/qr/v1 request to generate the one-time payment QR.

curl --location 'https://apitest.vipps.no/qr/v1' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni <truncated>" \
-H "Ocp-Apim-Subscription-Key: 0f14ebcab0ec4b29ae0cb90d91b4a84a" \
-H "Merchant-Serial-Number: 123456" \
-H "Vipps-System-Name: acme" \
-H "Vipps-System-Version: 3.1.2" \
-H "Vipps-System-Plugin-Name: acme-webshop" \
-H "Vipps-System-Plugin-Version: 4.5.6" \
-X POST \
-d '{
"url": "https://apitest.vipps.no/dwo-api-application/v1/deeplink/vippsgateway?v=2&token=eyJraWQiOiJqd3RrZXkiLCJhbGciOiJSUzI1NiJ<truncated>"
}'

Next steps

See the QR API guide to read about the concepts and details.