Payouts cannot be authorized without strong authentication from an approved user. An authorization URL can be obtained using the payouts/{id} GET action as shown below:
using System.Net.Http.Json;
const string baseUrl = "<<SANDBOX_URL>>payouts";
var jwtToken = Environment.GetEnvironmentVariable("NOFRIXION_USER_TOKEN");
// specify id of payout to return
string payoutId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Accept", "application/json");
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {jwtToken}");
try
{
var response = await client.GetAsync($"{baseUrl}/{payoutId}");
if (response.IsSuccessStatusCode)
{
// returns requested payout
var payout = await response.Content.ReadFromJsonAsync<Payout>();
if (payout != null)
{
// displays approval URL
Console.WriteLine(payout.approvePayoutUrl);
}
}
else
{
// HTTP error codes will return a MoneyMoov API problem object
Console.WriteLine(await response.Content.ReadFromJsonAsync<ApiProblem>());
}
}
catch (Exception e)
{
Console.WriteLine($"Error: {e.Message}");
}
// Type declarations for returned data
record Payout(string currentUserID, string currentUserRole, string approvePayoutUrl, string id,
string accountID, string userID, string type, string description, string currency,
decimal amount, string yourReference, string destinationIBAN, string destinationAccountID,
string destinationAccountName, string theirReference);
record ApiProblem(string type, string title, int status, string detail);
// This module allows the code to run on Node.js, it's not required if running in a browser.
const fetch = require('cross-fetch');
// Remember, the JWT access token must be securely store - this example uses an environment variable
const jwtToken = process.env.NOFRIXION_USER_TOKEN;
const baseUrl = '<<SANDBOX_URL>>payouts/';
// You need to specify payout Id.
var payoutId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
const options = {
method: 'GET',
headers: {
Accept: 'application/json',
Authorization: 'Bearer ' + jwtToken
}
};
fetch(baseUrl + payoutId, options)
.then(response => response.json())
// Get the approval URL
.then(responseJson => {
// Get the approval URL for a payout ...
console.log(responseJson.approvePayoutUrl);
})
.catch(err => console.error(err));
# The 'requests' module for Python can be used to make calls to the MoneyMoov API in popular python frameworks such as Django and Flask.
import requests
import os
# Remember, the JWT access token must be securely stored ('os' module above allows storage in environment variable)
jwtToken = os.environ['NOFRIXION_USER_TOKEN']
baseUrl = "<<SANDBOX_URL>>payouts"
# id of required payout must be specified
payoutId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
headers = {
"Accept": "application/json",
"Authorization": f"Bearer {jwtToken}"
}
response = requests.request("GET", f"{baseUrl}/{payoutId}", headers=headers)
if response.ok:
payout = response.json()
# Use the 'approvePayoutUrl' key for approving payouts.
print(payout['approvePayoutUrl'])
else:
# If not OK, response contains MoneyMoov problem (https://docs.nofrixion.com/reference/error-messages)
print(response.json())
Once the user is redirected to the authorization URL and completes the strong authentication process, they are redirected to the NoFrixion portal where the submission of the payout is confirmed.