Postman
Introduction
Mangopay provides a regularly updated Postman collection for you to test the Mangopay API in the Sandbox environment.
Mangopay API Postman collection
Prerequisites
- A
ClientId
and an API key – if you don’t have these, contact Sales to get access to the Mangopay Dashboard - A Postman account (you can install the preferred version for your system at https://www.getpostman.com/)
Click Run with Postman to fork the collection into your workspace:
Run with Postman
Set up your environment
Once the collection is forked, make sure you’ve selected the relevant environment and set up the key variables if they are not already defined:
ENV_URL
– Should be https://api.sandbox.mangopay.comAPI_KEY
– Your Sandbox API key, available in the Mangopay Dashboard.CLIENT_ID
– Your Client ID, available in the Mangopay Dashboard.VERSION
– Must be the Mangopay API version which isV2.01
.
We also recommend you set variables used for some specific calls:
CURRENCY
– Enter the default currency for your tests. Keep in mind that some payment methods don’t support all currencies, so you might need to update them manually at times.CULTURE
– Enter the default culture value. The Culture parameter is mostly used in web payment methods, but keep in mind that payment methods don’t necessarily support the same cultures. We recommend you use EN for a better experience.
Note - Other variables populated automatically
Where relevant, calls in the collection contain tests (in the Tests tab of the request) that populate other variables based on the response from the API.
For example, the Create a Natural User call populates a USER_NATURAL_PAYER
variable; Create a Wallet populates a WALLET_ID
, and so on. Likewise, during the card registration process, the tests populate the tokenization data automatically, meaning you should be able to submit the calls one after another without having to copy and paste values manually.
Authenticate Postman calls
The Mangopay API uses OAuth 2.0 to authenticate calls, which is supported by Postman.
In Postman, authentication for the collection is managed in the Authorization tab of the parent folder. Child folders and individual calls inherit this authentication.
In the Authorization tab, the API_KEY
and CLIENT_ID
variables are set up to call the OAuth token endpoint.
Note – Postman auto-refreshes tokens
Postman can automatically refresh the OAuth token, but the first token needs to be generated manually.
You also need to generate a new token manually if you change from one collection to another, or from one set of API credentials (Client ID and API key) to another.
How to generate a token
- On the Authorization tab of the collection, scroll down to the bottom and click on Get new access token.
- Postman calls the OAuth token endpoint to get a token. Once done, click Proceed (Postman proceeds automatically after 5 seconds).
- In the Manage access tokens dialog, you can see the details of the generated token. On the left, you can see all other tokens with the option to delete expired tokens. Click Use token to add the token to the Authorization tab and use it to authenticate calls.
Understand the collection
The Mangopay API Postman collection is built with variables and scripts to so that you can test a flow of actions more easily. There are folders for specific features or flows, as well as the full reference of API endpoints.
You’ll also find comments with further guidance in the body of relevant requests.
Stay up to date
The Mangopay API Postman collection is regularly updated by Mangopay teams.
Watch the collection to be notified of updates via email, and then pull the changes to bring your fork up to date.
Was this page helpful?