Quick start
Use the Checkout API to create a checkout session and retrieve session information.
Before you begin
This document covers the quick steps for getting started with the Vipps Checkout 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.
Your first Checkout
Step 1 - Setup
- curl
- Postman
Please note: Postman is discontinuing their offline version. Use only your test keys and delete them after testing. Ensure that your company allows for cloud use before continuing.
If you wish to use Postman, import the following files:
In Postman, tweak the environment with your own values (see API keys):
client_id
- Merchant key required for getting the access token.client_secret
- Merchant key required for getting the access token.Ocp-Apim-Subscription-Key
- Merchant subscription key.Merchant-Serial-Number
- Merchant ID.
You can update any of the other environment variables. Be aware of this:
- Any currency amount must be an Integer value minimum 100 in øre.
- Most URLs must be
https
.
No setup needed :)
Step 2 - Create a checkout session
Create a checkout session with: POST:/v3/session
.
- curl
- Postman
Send request Create a Checkout Session
The reference
variable is automatically set in the environment
of this Postman example.
curl https://apitest.vipps.no/checkout/v3/session \
-H "Content-Type: application/json" \
-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 \
-d '{
"merchantInfo": {
"callbackUrl": "https://example.com/vipps/callbacks-for-checkout",
"returnUrl": "https://example.com/vipps/fallback-result-page-for-both-success-and-failure/acme-shop-123-order123abc",
"callbackAuthorizationToken": "538dd1d0-9e7f-4732-8134-dfed7fd0b236"
},
"transaction": {
"amount": {
"value": 1000,
"currency": "NOK"
},
"reference": "UNIQUE-SESSION-REFERENCE",
"paymentDescription": "One pair of socks."
}
}'
Take note of the reference
value, as it can be used for subsequent calls relating to this session.
To display the session, you will need to load the Checkout SDK in your website, as described in API Guide: Displaying the session.
Step 3 - Retrieve the session information
Retrieve the session information by using
GET:/v3/session/{reference}
with reference
from the previous step.
- curl
- Postman
Send request Get session info
You will see the details appear in the lower pane.
curl https://apitest.vipps.no/checkout/v3/session/UNIQUE-SESSION-REFERENCE \
-H "Content-Type: application/json" \
-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 GET