If you'd like to test our Payments API (V3), using Insomnia Core, follow the steps below.
For more information about our Payments API (v3), check our documentation.
Requirements
Download the files below before starting:
Steps:
-
Importing Payouts API File:
-
- Open Insomnia Core and go to the
Preferences
menu, then open the Data
tab
- From the
Data
tab, click on the Import Data
selector and choose the From file
option
- Select and import the Insomnia Payments API collection JSON file.
- You should now see folders relative to all the Payments endpoints available.
-
1. Go to
Preferences
> Plugins
2. Enter insomnia-plugin-jws-by-truelayer
in the plugin bar.
3. Once you installed it, make sure it’s active.
-
Setting the required properties.
- The last step is making sure your environment has the required properties (they are defined with a JSON object, see here). You can either add the properties in the global environments (Image 1 & 2 below) or by right-clicking on the folder and setting the properties at the folder level (Image 3 & 4 below) or a combination of both (folder level properties override global environment properties). Global environment variables.Folder level environment variables.
- Each one of these properties can be found in the following locations:
ENVIRONMENT_URI
- When you click an option in the dropdown, this variable will automatically set.
REQUIRE_JWS
- This must be set to true
CERTIFICATE_ID
- This is taken from the TrueLayer console, found in the settings section of the Payouts API dashboard, it is found underneath the “KID” section.
Client_ID
- This can be found in your console in the setting menu.
Client_Secret
- This can be found where you stored the client_secret.txt
file.
PRIVATE_KEY
- This is the private key that you created.
JSON does not allow line breaks, so you have to replace all the line breaks with a newline character “\n”.
Here is what a Private Key certificate looks like before you edit it:
You can run this command in the terminal putting in your private key file's location after the command.
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' file_location/cert-name.pem
It should then look like this:
You can then copy and paste the returned string into the PRIVATE_KEY
value section.
Environment variables example:
{
"ENVIRONMENT_URI": "https://pay-api.truelayer-sandbox.com",
"AUTH_SERVER_URI": "https://auth.truelayer-sandbox.com",
"REQUIRE_JWS": true,
"CLIENT_ID": "<Your-Client_ID",
"CLIENT_SECRET": "<Your-Client_Secret>",
"CERTIFICATE_ID": "KID-from-TrueLayer-Console",
"PRIVATE_KEY": "-----BEGIN EC PRIVATE KEY-----<YOUR_PRIVATE_KEY>-----END EC PRIVATE KEY-----\n"
}
4. Use the endpoints!
Make sure to:
- Include the Idempotency-Key
UUID parameter in the request headers (should be included already in every request of the Collection).
- Trigger the request to "generate the Payment token". That will generate the access token the other endpoints need to work (which should be in any case automatically requested in case of an expired access_token in every request, and then shared automatically to the other endpoints of the Collection).
Comments
0 comments
Please sign in to leave a comment.