> **Description:** Step-by-step guide for accounting partners to start fetching sales data, including authentication setup and basic API calls.

# Quick start

This guide is for **accounting partners** using [accounting keys](https://developer.vippsmobilepay.com/docs/partner/partner-keys.md#accounting-keys). Run the basic Sales API calls in curl to start retrieving sales data for your merchants.

## Before you begin

**Production only**

The Sales API is not available in the test environment. All requests in this guide use the production server, [`https://api.vipps.no`](https://api.vipps.no).

## Getting your sales information

### Step 1 - Setup

You must have already signed up as an organization with Vipps MobilePay and obtained accounting keys.

You will need the following values from your [accounting keys](https://developer.vippsmobilepay.com/docs/partner/partner-keys.md#accounting-keys):

* `client_id` - Client ID from your accounting keys.
* `client_secret` - Client secret from your accounting keys.

The example values in this guide must be replaced with the values from your accounting keys.
This applies to API keys, HTTP headers, references, and similar values.

### Step 2 - Get an access token

All API endpoints require that you first obtain an API token.

Accounting partners use accounting keys with the
[Specialized authentication](https://developer.vippsmobilepay.com/docs/APIs/access-token-api/specialized-authentication.md).

The value for authorization is a string representing your Base64-encoded API keys, `client_id` and `client_secret`.

**How to convert your keys to Base64:**

Example of how to convert your `client_id` and `client_secret` to base64 with JavaScript:

```javascript
const clientId = 'YOUR-CLIENT-ID';
const clientSecret = 'YOUR-CLIENT-SECRET';
const base64Credentials = btoa(`${clientId}:${clientSecret}`);
console.log(base64Credentials);
```

**Send the token request:**

To get the token, you will send the [`POST:/miami/v1/token`](https://developer.vippsmobilepay.com/redocusaurus/access-token-swagger-id.yaml) request.

Provide the Base64-encoded value in the `Authorization` heading in a request.
For example:

```bash
curl -X POST https://api.vipps.no/miami/v1/token \
-H 'Authorization: Basic <YOUR-BASE64-ENCODED-VALUE>' \
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
-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' \
--data-urlencode 'grant_type=client_credentials'
```

**WARNING**

You must include the last line with `'grant_type=client_credentials'`, or
you'll get an `invalid_client` error.

The `Ocp-Apim-Subscription-Key` HTTP header should *not* be sent.

It's a good idea to include the [standard HTTP headers](https://developer.vippsmobilepay.com/docs/knowledge-base/http-headers.md)
in your requests (e.g., `Vipps-System-Name`, `Vipps-System-Version`),
because these will help us to debug the problem, if you have one.

An access token will be returned. For example:

```json
{
  "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni <truncated>",
  "token_type": "Bearer",
  "expires_in": 900
}
```

This is your identity in API requests.
You can use this in API requests until it expires, in 15 minutes.

### Step 3 - Get all ledgers

Send
[`GET:/settlement/v1/ledgers`](https://developer.vippsmobilepay.com/redocusaurus/report-swagger-id.yaml)
to get the ledgers you have access to.

```bash
curl -X GET https://api.vipps.no/settlement/v1/ledgers \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR-ACCESS-TOKEN" \
```

### Step 4 - Get a continuous feed of sales events

Use
[`GET:/sales/report/v1/ledgers/{ledgerId}`](https://developer.vippsmobilepay.com/redocusaurus/sales-swagger-id.yaml)
to get a continuous stream of sales data.

Query parameters:

* `cursor` -- if not provided, the response starts from the first sale on the given `ledgerId`. Each response includes a `cursor` indicating where the stream stopped. Persist the cursor and include it in subsequent requests to continue from the last checkpoint.
* `pageSize` -- limits the number of rows returned per request (default: 100, max: 1000).

```bash
curl -X GET "https://api.vipps.no/sales/report/v1/ledgers/{ledgerId}?pageSize=100" \
-H "Authorization: Bearer YOUR-ACCESS-TOKEN" \
```

### Step 5 - Get sales events for a specific date

Use
[`GET:/sales/report/v1/ledgers/{ledgerId}/dates/{ledgerDate}`](https://developer.vippsmobilepay.com/redocusaurus/sales-swagger-id.yaml)
to return sales data for a specific date.

Set `ledgerDate` to a value in the format YYYY-MM-DD (e.g., `2026-05-01`).

If the number of sales exceeds the response limit, the response includes a `cursor` and `hasMore = true`. Repeat the request for the same date including the `cursor` to retrieve the remaining records.

```bash
curl -X GET "https://api.vipps.no/sales/report/v1/ledgers/{ledgerId}/dates/2026-05-01" \
-H "Authorization: Bearer YOUR-ACCESS-TOKEN" \
```

### Step 6 - Get sales events by merchant reference

Use
[`GET:/sales/report/v1/ledgers/{ledgerId}/references/{reference}`](https://developer.vippsmobilepay.com/redocusaurus/sales-swagger-id.yaml)
to return all captures and returns related to a specific reference.

```bash
curl -X GET "https://api.vipps.no/sales/report/v1/ledgers/{ledgerId}/references/{reference}" \
-H "Authorization: Bearer YOUR-ACCESS-TOKEN" \
```

### Step 7 - Get sales events by PSP reference

Use
[`GET:/sales/report/v1/ledgers/{ledgerId}/psp-references/{pspReference}`](https://developer.vippsmobilepay.com/redocusaurus/sales-swagger-id.yaml)
to return a specific capture or return using the PSP reference.

```bash
curl -X GET "https://api.vipps.no/sales/report/v1/ledgers/{ledgerId}/psp-references/{pspReference}" \
-H "Authorization: Bearer YOUR-ACCESS-TOKEN" \
```

## Next steps

* [API guide](https://developer.vippsmobilepay.com/docs/APIs/sales-api/api-guide.md): Authentication, all endpoints, field semantics, and the Report API mapping.
* [API reference](https://developer.vippsmobilepay.com/redocusaurus/sales-swagger-id.yaml): Full endpoint specifications.
* [VM Number: Reporting and APIs](https://vmnumber.vippsmobilepay.com/reporting-and-apis/): Overview of how the Sales API and Report API fit together.

> **Full site overview:** For every page in this documentation, read [https://developer.vippsmobilepay.com/llms.txt](https://developer.vippsmobilepay.com/llms.txt).
