# Accessing Real-time Transaction History
source: https://developer.mastercard.com/open-finance-europe/documentation/tutorials-and-guides/accessingreal-time-transaction-history-tutorial/index.md

In this tutorial, we'll guide you through the steps to access your real-time transaction history seamlessly.

### Step 1 - Client Starts Connect Flow {#step-1---client-starts-connect-flow}

1. The Client make a call to start Connect Flow.

```shell
curl -D- -G \
  https://api-sandbox.aiia.eu/v1/oauth/connect \
  -d client_id=<CLIENT_ID> \
  -d redirect_uri=<REDIRECT_URL> \
  -d scope="payments:inbound" \
  -d response_type=code 
```

​

2. The service replies with Connect URL

```shell
Location=https://api.aiia.eu/v1/oauth/connect?client_id=%3Cstring%3E&redirect_uri=%3Cstring%3E&response_type=%3Cstring%3E`
```

### Step 2 - User Onboards Account​ {#step-2---user-onboards-account}

The user onboards Account through the UI and authorized to access the beneficiary account, navigates to URL and completes:

* Signing up
* Accept Consent if presented
* Choose Bank
* Log Into Bank
* Choose Account
* Accept consent to pass data to Client's app
* Due Diligence

![](https://static.developer.mastercard.com/content/open-finance-europe/uploads/UserOnboardsaccount.PNG)

### Step 3 - User redirected and code received {#step-3---user-redirected-and-code-received}

Once end users have completed the connection flow, they will be redirected back to your specified redirect_uri. This redirect will have a query parameter called code sent with it, which you need to gain an access token.

User is redirected back to provided `REDIRECT_URL` With a `code` and a `ConsentID`

Along with the code, you get a consentId. This id is your representation of a user and is valid as long the user has given his or her consent for you to fetch data. A good idea is to store this id along with your tokens. We use this id when we send you webhooks.

### Step 4 - Client Exchanges code for tokens {#step-4---client-exchanges-code-for-tokens}

Client exchange code to receive tokens by calling the endpoint

```shell
curl -X POST \
  https://api-sandbox.aiia.eu/v1/oauth/token \
  -u <CLIENT_ID>:<CLIENT_SECRET>
  -H 'Content-Type: application/json' \
  -d '{
        "grant_type" : "authorization_code"
        "code": "<CODE>"
        "redirect_uri" : "<REDIRECT_URL>"
      }'
```

the response will contain

`access_token`(expires after one hour)
`refresh_token`(expires after 14 days)

### Step 5 - Fetch DestinationID {#step-5---fetch-destinationid}

Client calls

`v1/accounts` end point with:​
`access_token`

Client fetch the:​

`destinationId​` (dedicated field to identify the account​)

9. At this point the Client can Request a payment by calling

`v2/payments/accept​`

or​

`v2/payments/accept/links`

destinationId is used to identify the account that will receive the payment​

### Step 6 - Request a payment {#step-6---request-a-payment}

At this point the Client can Request a payment by calling

`v2/payments/accept​`

or​

`v2/payments/accept/links`

`destinationId` is used to identify the account that will receive the payment​
