# Get a payment consent

Follow the steps below to create a domestic payment consent. The same steps with minor changes can be followed for other types of payment consents.

## 1. Get the access token

First, in the collections, under **Payments**, open the **Get Access Token** request and click **Send**. 

If your environment was [set up](set-up-postman) properly, there is no need to change any parameter. 

The request returns a JSON containing an `access_token`, which is automatically saved to the `access_token` environment variable. 
There's no need to copy the value; it will automatically be used in the following requests.

![Postman request - Get Access Token](/img/build-banking-apps/tutorials/test-with-postman/postman-ob-get-pisp-access-token.png)

## 2. Create a consent

1. Under **Domestic Payments**, open the **Domestic Payment Consent** request.

   ![Postman request - Domestic payment consent](/img/build-banking-apps/tutorials/test-with-postman/postman-ob-create-domestic-payment-consent.png)
2. The request body already contains some default values, which can be updated if required. Here you can define the [payment parameters](/docs/api/open-banking#create-a-domestic-payment-consent).
3. Click **Send**.  
    The request returns a JSON containing a `ConsentId` value. This value is automatically saved to the environment variable `consentId`.
4. Open the Postman console.

   ![Postman console - Redirect link](/img/build-banking-apps/tutorials/test-with-postman/postman-ob-console.png)
5. The redirect URL is automatically generated and printed in the console. 
    Copy the URL and paste it in a browser.
6. Enter the Sandbox test account credentials and authorise the consent.
7. Once completed, you are redirected to the URL which you defined in your Sandbox application.
    Copy the value from the `code` parameter from this URL. You will need it in the next step.

:::note
When creating the consent, our custom pre-request script automatically calculates the JWS signature of the request body using your private
key and saves it into the `jws_signature` environment variable, which is then used in the `x-jws-signature` header of the request.
:::

## 3. Get the payment access token

1. Open the **Get Payment Access Token** request in Postman.
2. Paste the `code` parameter which was retrieved from the previous redirect URI and click **Send**.

   ![Postman request - Get Payment Access Token](/img/build-banking-apps/tutorials/test-with-postman/postman-ob-get-pisp-payment-access-token.png)

In the response, you see a JSON with an `access_token` parameter. 
This has automatically been saved to the `payments_access_token` environment variable for later use.

## 4. Execute the payment

1. Under **Domestic Payments**, open the **Create a domestic payment** request.

   ![Postman request - Get Payment Access Token](/img/build-banking-apps/tutorials/test-with-postman/postman-ob-create-domestic-payment.png)
2. In the request body, put the exact same content that you sent in the body of the [consent request](#2-create-a-consent).
    Add the `Data.ConsentId` key-value pair required in this request. Use the consent ID you received when [creating the consent](#2-create-a-consent).
:::tip
You can use `{{consentId}}` as in the default request body to use the `consentId` environment variable which was automatically saved previously.
See the screenshot above.
:::
3. Click **Send**. The JWS signature is automatically pre-calculated and saved into the `jws_signature` environment variable.

In the response, you get the result of the payment.