# Integration and Testing
source: https://developer.mastercard.com/straight-through-processing/documentation/tutorials-and-guides/integration-and-testing-tutorial/index.md

This tutorial walks you through the steps required to test STP APIs after creating a Sandbox project. You can follow similar steps to test STP APIs in Production once your access is approved.

### What you will learn {#what-you-will-learn}

* How to configure the STP APIs for testing via the Insomnia tool in the Sandbox environment. The Insomnia tool can test API calls by filling in the parameters without writing code.
* How to build an end-to-end Java application that will integrate with STP APIs.

<br />

Click **Next** to begin.

### Step 1 {#step-1}

*** ** * ** ***

### title: "Insomnia Setup"
date: 2019-02-25T12:04:30-05:00
weight: 100 {#weight-100}

## Insomnia {#insomnia}

The Insomnia tool is a popular open-source REST client application that works on Windows, Mac, and Linux operating systems. It is a handy tool for developers to test API calls by filling in the parameters without writing code. We can test the STP APIs with this tool.

### What you will learn {#what-you-will-learn-1}

* How to set up the Sandbox environment in the Insomnia tool.
* How to configure the STP APIs for testing via the Insomnia tool.
* How to test the STP APIs.

### Pre-requisites {#pre-requisites}

1. Create a project for the STP API.
2. Install the [Insomnia tool](https://insomnia.rest/).
3. Install the [Mastercard Insomnia Plugin](https://github.com/Mastercard/insomnia-plugin-mastercard-auth#installation-).

Tip: To create your project on Mastercard Developers, refer to the [Create a Sandbox project](https://developer.mastercard.com/straight-through-processing/documentation/tutorials-and-guides/create-sandbox-project-tutorial/index.md) section for more information. If you have any issues with installation, refer to the [Manual Installation](https://github.com/Mastercard/insomnia-plugin-mastercard#3-manual-installation) steps.

## Import STP Collection {#import-stp-collection}

To set up, we have included a ready-to-test
[Collection.zip](https://static.developer.mastercard.com/content/straight-through-processing/uploads/Collection.zip) (5KB), which includes all STP APIs for download. To import the Collection from Insomnia:

1. Navigate to **Application** \> **Preferences** \> **Data**.
2. Click **Import to the "Insomnia" Project**.
3. Navigate to the location where the STP API collection was downloaded.
4. Click **Scan**.

## Navigating the STP Collection {#navigating-the-stp-collection}

The STP Collection contains:

* One STP Workspace.
* One Sub Environment that is specifically configured to work with the corresponding API requests.

Note: Ensure the correct configuration is selected for the chosen API.

## STP Environment Configuration {#stp-environment-configuration}

|                         Key                          |                      Value                      |                                  Description                                  |
|------------------------------------------------------|-------------------------------------------------|-------------------------------------------------------------------------------|
| host                                                 | "https://sandbox.api.mastercard.com/stp-api/v1" | Mastercard Developers Host URL                                                |
| mastercard                                           |                                                 | Mastercard Insomnia Plugin Object                                             |
| mastercard.consumerKey                               | \[Sandbox Consumer Key\]                        | Sandbox consumer key generated during Create a New Project                    |
| mastercard.keystoreP12Path                           | \[Sandbox PKCS#12 Certificate\]                 | Sandbox PKCS#12 certificate generated during Create a New Project             |
| mastercard.keyAlias                                  | \[Sandbox PKCS#12 Key Alias\]                   | Sandbox PKCS#12 Key Alias generated during Create a New Project               |
| mastercard.keystorePassword                          | \[Sandbox PKCS#12 Keystore Password\]           | Sandbox PKCS#12 Keystore Password generated during Create a New Project       |
| mastercard.encryptionConfig                          |                                                 | Mastercard Insomnia Plugin for Encryption Object                              |
| mastercard.encryptionConfig.paths                    | \[Encryption/Decryption Paths\]                 | Payload paths and elements to Encrypt/Decrypt                                 |
| mastercard.encryptionConfig.mode                     | "JWE"                                           | Encryption mode                                                               |
| mastercard.encryptionConfig.encryptedValueFieldName  | \[Encryption/Decryption Field\]                 | Payload field to Encrypt/Decrypt                                              |
| mastercard.encryptionConfig.publicKeyFingerprintType | "publicKey"                                     | Encryption Fingerprint Type                                                   |
| mastercard.encryptionConfig.encryptionCertificate    | \[Client Encryption Certificate\]               | Client Encryption Certificate downloaded during Create a New Project          |
| mastercard.encryptionConfig.keyStore                 | \[Mastercard Encryption Certificate\]           | Mastercard Encryption certificate generated during Create a New Project       |
| mastercard.encryptionConfig.keyStoreAlias            | \[Mastercard Encryption Key Alias\]             | Mastercard Encryption Key Alias generated during Create a New Project         |
| mastercard.encryptionConfig.keyStorePassword         | \[Mastercard Encryption Keystore Password\]     | Mastercard Encryption Keystore Password generated during Create a New Project |

## Invoking Suppliers using Insomnia {#invoking-suppliers-using-insomnia}

This section provides step-by-step directions to call the [STP API endpoints](https://developer.mastercard.com/straight-through-processing/documentation/api-reference/index.md) which are `POST /suppliers`, `GET /suppliers/{id}`, and `PUT /suppliers/{id}` services from the Insomnia tool.
Note: Refer [API Reference](https://developer.mastercard.com/straight-through-processing/documentation/api-reference/index.md) page for more details on each API and related parameters.

### Testing Submit Supplier - POST /suppliers {#testing-submit-supplier---post-suppliers}

1. Select the **Sandbox Config for STP API** environment.
2. Expand the **STP API** folder.
3. Select the **Create STP Supplier - Submit** request.

Tip: The `name and clientRef` must be unique.

4. Click the **Send** button. Note: Extract the `id` from the response -- self (href).

### Testing Supplier - GET /suppliers/{id} {#testing-supplier---get-suppliersid}

1. Select the **Sandbox Config for STP** environment.
2. Expand the **STP API** folder.
3. Select the **Get STP Supplier** request.
4. Click the **Send** button.

### Testing Supplier -- PUT /suppliers/{id} {#testing-supplier--put-suppliersid}

1. Select the **Sandbox Config for STP API** environment.
2. Expand the **STP API** folder.
3. Select the **Update STP Supplier** request.

Tip: If you want to search specific request ID append url with the `id`.

4. Click the **Send** button.

## Invoking Payments using Insomnia {#invoking-payments-using-insomnia}

This section provides step-by-step directions to call the `POST /payments`, `GET /payments/{id}`, and `GET /payments/{id}/status` services from the Insomnia tool.
Note: Refer [API Reference](https://developer.mastercard.com/straight-through-processing/documentation/api-reference/index.md) page for more details on each API and related parameters.

### Testing POST /payments {#testing-post-payments}

1. Select the **Sandbox Config for create STP payments** environment.
2. Expand the **STP API** folder.
3. Select the **Create STP Payments** request. Tip: Modify the links-**supplier-href** value to `id`.
4. Click the **Send** button. Note: Fetch `id` from the response -- self (href).

### Testing GET /payments/{paymentid} {#testing-get-paymentspaymentid}

1. Select the **Sandbox Config for details of STP payments** environment.
2. Expand the **STP API** folder.
3. Select the **Get STP Payments** request. Tip: If you want to search specific payment request ID append url with the `id`.
4. Click the **Send** button.

### Testing GET /payments/{paymentid}/status {#testing-get-paymentspaymentidstatus}

1. Select the **Sandbox Config for payments id status** environment.
2. Expand the **STP API** folder.
3. Select the **Get STP Payment Status** request. Tip: Modify the `id` in endpoint.
4. Click the **Send** button.

## Invoking Providers using Insomnia {#invoking-providers-using-insomnia}

This section provides step-by-step directions to call the `GET /providers` and `GET /providers/{id}` services from the Insomnia tool.
Note: Refer [API Reference](https://developer.mastercard.com/straight-through-processing/documentation/api-reference/index.md) page for more details on each API and related parameters.

### Testing GET /providers {#testing-get-providers}

1. Select the **Sandbox Config for providers** environment.
2. Expand the **STP API** folder.
3. Select the **Get Providers** request.
4. Click the **Send** button.

### Testing GET /providers/{id} {#testing-get-providersid}

1. Select the **Sandbox Config for providers id** environment.
2. Expand the **STP API** folder.
3. Select the **Get Providers by id** request. Note: Modify the `Id` in the endpoint.
4. Click the **Send** button.

## Invoking Reconciliation Records using Insomnia {#invoking-reconciliation-records-using-insomnia}

This section provides step-by-step directions to call the `POST /reconciliation-records` and `GET /reconciliation-records` services from the Insomnia tool.
Note: Refer [API Reference](https://developer.mastercard.com/straight-through-processing/documentation/api-reference/index.md) page for more details on each API and related parameters.

### Testing POST /reconciliation-records {#testing-post-reconciliation-records}

1. Select the **Sandbox Config for post reconciliation-records** environment.
2. Expand the **STP API** folder.
3. Select the **POST reconciliation-records** request. Note: Modify the `paymentId` value to `payment` id.
4. Click the **Send** button.

### Testing GET /reconciliation-records/{paymentId} {#testing-get-reconciliation-recordspaymentid}

1. Select the **Sandbox Config for get reconciliation-records** environment.
2. Expand the **STP API** folder.
3. Select the **GET reconciliation-records** request. Tip: Provide a date range to search for specific records. For example, `GET /reconciliation-record-service/reconciliation-records?start_date=2020-07-13T10:00&end_date=2020-08-12T18:40&page=0&page_length=1`
4. Click the **Send** button.
