# Test the API using Insomnia
source: https://developer.mastercard.com/community-pass-payment-apis/documentation/api-tutorials/test-api-using-insomania/index.md

[Insomnia](https://insomnia.rest/) 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 simply filling in the parameters without writing any code.

The MCPP APIs can also be tested with this tool. This tutorial will help you set up the Insomnia tool and test the API in Sandbox. You can follow similar steps to test API in Production once your access is approved.

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

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

### Estimated time to complete this tutorial {#estimated-time-to-complete-this-tutorial}

> * 15-20 minutes

## Pre-requisites {#pre-requisites}

1. Create a project for the MCPP APIs in Mastercard Developers portal.
2. [Insomnia](https://insomnia.rest/download/) tool installed.
3. [Mastercard Insomnia Plugin](https://developers.mastercard.com) installed.

Note: To create your project on Mastercard Developers, refer to [Getting Started](https://developer.mastercard.com/community-pass-payment-apis/documentation/getting-started/index.md) for more information.

## Invoking MCPP APIs Using Insomnia {#invoking-mcpp-apis-using-insomnia}

Tip: Please refer this [page](https://github.com/Mastercard/insomnia-plugin-mastercard) for Insomnia installation and Sandbox environment configuration.

This section provides step-by-step directions to call the /payment service from the Insomnia tool.

1. Click '+' beside the 'Filter' text-box and select the "New Request" option to create a new request. ![Test API in Sandbox using Insomnia](https://static.developer.mastercard.com/content/community-pass-payment-apis/documentation/images/insomnia7.PNG "Test API in Sandbox using Insomnia")
2. Name the request as "Callback", select the request method as "POST", body type as "JSON" and click Create. ![Test API in Sandbox using Insomnia](https://static.developer.mastercard.com/content/community-pass-payment-apis/documentation/images/insomnia8.PNG "Test API in Sandbox using Insomnia") ![Test API in Sandbox using Insomnia](https://static.developer.mastercard.com/content/community-pass-payment-apis/documentation/images/insomnia9.PNG "Test API in Sandbox using Insomnia") ![Test API in Sandbox using Insomnia](https://static.developer.mastercard.com/content/community-pass-payment-apis/documentation/images/insomnia10.PNG "Test API in Sandbox using Insomnia")
3. Configure the request URL by copy and pasting the text **{{host}}/community-pass/payment/callbacks** in the request URL. ![Test API in Sandbox using Insomnia](https://static.developer.mastercard.com/content/community-pass-payment-apis/documentation/images/insomnia11.PNG "Test API in Sandbox using Insomnia")
4. The MCPP APIs endpoints you will call requires [payload encryption](https://developer.mastercard.com/platform/documentation/security-and-authentication/securing-sensitive-data-using-payload-encryption/). You need to encrypt the request body before you send request through Insomnia tool.


Tip: You can also refer to the reference application
[client-encryption-app.zip](https://static.developer.mastercard.com/content/community-pass-payment-apis/referenceapp/client-encryption-app.zip) (2MB) which we have created for you to encrypt the request payload. Please walkthrough the steps mentioned in README.md to generate encrypted request payload.
Sample encrypted request payload generated from `client-encryption-reference` application. ![Test API in Sandbox using Insomnia](https://static.developer.mastercard.com/content/community-pass-payment-apis/documentation/images/insomnia-payload-encrypt.PNG "Test API in Sandbox using Insomnia") 5. Configure the request payload by copying encrypted payload from Step-4 and paste here. ![Test API in Sandbox using Insomnia](https://static.developer.mastercard.com/content/community-pass-payment-apis/documentation/images/insomnia12.PNG "Test API in Sandbox using Insomnia") 6. Send the request by clicking the **Send** button. You should see a successful response with **200** OK. ![Test API in Sandbox using Insomnia](https://static.developer.mastercard.com/content/community-pass-payment-apis/documentation/images/insomnia13.PNG "Test API in Sandbox using Insomnia") 7. You have successfully invoked MCPP APIs `/callbacks` end point from the Insomnia tool. 8. You can invoke other services by following steps 1-6 of this section. Check other service endpoints on the [API Reference](https://developer.mastercard.com/community-pass-payment-apis/documentation/api-reference/index.md) page.

<br />

### Services Testability list {#services-testability-list}

The following table captures the services of MCPP APIs that can be tested using Insomnia:

|        Service        |        Endpoint         | Testable using Insomnia |
|-----------------------|-------------------------|-------------------------|
| Payment Callbacks     | /payments/callbacks     | Yes                     |
| Payment Notifications | /payments/notifications | Yes                     |
| Payment Validations   | /payments/validations   | Yes                     |

Note: The [Community Pass Payment service](https://developer.mastercard.com/community-pass-payment-apis/documentation/use-cases/index.md) expects an encrypted request object as it contains PCI data. To understand how to encrypt a request object, refer to the [Build an end-to-end application](https://developer.mastercard.com/community-pass-payment-apis/documentation/api-tutorials/build-end-to-end-application/index.md) tutorial.

### Congratulations {#congratulations}

You have successfully completed this tutorial and setup Insomnia tool to call MCPP APIs.

### Next Steps {#next-steps}

You should check out the following resources:

* [Request for Production Access](https://developer.mastercard.com/community-pass-payment-apis/documentation/api-tutorials/move-to-production/index.md)
* [API Reference](https://developer.mastercard.com/community-pass-payment-apis/documentation/api-reference/index.md)
