{
"FirstName": "AcceptUBO",
"LastName": "Effertz",
"Birthday": 652117514,
"Nationality": "FR",
"Address": {
"AddressLine1": "804 Hane Mountains",
"AddressLine2": "Adriel Overpass",
"City": "Paris",
"Region": "Île-de-France",
"PostalCode": "75001",
"Country": "FR"
},
"Birthplace": {
"City": "Paris",
"Country": "FR"
}
}
<?php
require_once 'vendor/autoload.php';
use MangoPay\MangoPayApi;
use MangoPay\Libraries\ResponseException as MGPResponseException;
use MangoPay\Libraries\Exception as MGPException;
$api = new MangoPayApi();
$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';
$api->Config->TemporaryFolder = 'tmp/';
try {
$userId = '198557165';
$uboDeclarationId = '198692872';
$ubo = new \MangoPay\Ubo();
$address = new \MangoPay\Address();
$address->AddressLine1 = 'Address line 1';
$address->AddressLine2 = 'Address line 2';
$address->City = 'Paris';
$address->Country = 'FR';
$address->PostalCode = '75000';
$address->Region = 'Region';
$ubo->Address = $address;
$ubo->FirstName = 'AcceptUBO';
$ubo->LastName = 'Doe';
$ubo->Nationality = 'FR';
$ubo->Birthday = mktime(0, 0, 0, 12, 21, 1975);
$Birthplace = new \MangoPay\Birthplace();
$Birthplace->City = 'Paris';
$Birthplace->Country = 'FR';
$ubo->Birthplace = $Birthplace;
$response = $api->UboDeclarations->CreateUbo($userId, $uboDeclarationId, $ubo);
print_r($response);
} catch(MGPResponseException $e) {
print_r($e);
} catch(MGPException $e) {
print_r($e);
}
const mangopayInstance = require('mangopay4-nodejs-sdk')
const mangopay = new mangopayInstance({
clientId: 'your-client-id',
clientApiKey: 'your-api-key',
})
let myUser = {
Id: '170853400',
}
let myUboDeclaration = {
Id: '180932134',
}
let myUbo = {
FirstName: 'AcceptUBO',
LastName: 'Smith',
Address: {
AddressLine1: '669 Ratke Forge',
AddressLine2: 'Schamberger Walk',
City: 'Paris',
Region: 'Île-de-France',
PostalCode: '75001',
Country: 'FR',
},
Nationality: 'FR',
Birthday: 652117514,
Birthplace: {
City: 'Paris',
Country: 'FR',
},
}
const createUbo = async (userId, uboDeclarationId, ubo) => {
return await mangopay.UboDeclarations.createUbo(userId, uboDeclarationId, ubo)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
createUbo(myUser.Id, myUboDeclaration.Id, myUbo)
require 'mangopay'
MangoPay.configure do |client|
client.preproduction = true
client.client_id = 'your-client-id'
client.client_apiKey = 'your-api-key'
client.log_file = File.join(Dir.pwd, 'mangopay.log')
end
def createUbo(legalUserId, uboDeclarationId, uboObject)
begin
response = MangoPay::Ubo.create(legalUserId, uboDeclarationId, uboObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to create UBO: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myLegalUser = {
Id: '194338122'
}
myUboDeclaration = {
Id: '194511216'
}
myUbo = {
FirstName: 'AcceptUBO',
LastName: 'Smith',
Address: {
AddressLine1: '669 Ratke Forge',
AddressLine2: 'Schamberger Walk',
City: 'Paris',
Region: 'Île-de-France',
PostalCode: '75001',
Country: 'FR'
},
Nationality: 'FR',
Birthday: 652117514,
Birthplace: {
City: 'Paris',
Country: 'FR'
}
}
createUbo(myLegalUser[:Id], myUboDeclaration[:Id], myUbo)
import com.mangopay.MangoPayApi;
import com.mangopay.core.Address;
import com.mangopay.core.enumerations.CountryIso;
import com.mangopay.entities.Birthplace;
import com.mangopay.entities.Ubo;
import com.mangopay.entities.UboDeclaration;
import com.mangopay.entities.UserLegal;
import java.lang.reflect.Field;
public class CreateUBO {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
UserLegal myUser = mangopay.getUserApi().getLegal("user_m_01HQK53VP687RBSH2Q5TJZRR3S");
UboDeclaration myUboDeclaration = mangopay.getUboDeclarationApi().get("ubo_m_01HRYRPZDB3KXF0QZ6QZ5C95A8");
Ubo myUbo = new Ubo();
Address address = new Address();
Birthplace birthplace = new Birthplace();
address.setAddressLine1(myUser.getHeadquartersAddress().getAddressLine1());
address.setAddressLine2(myUser.getHeadquartersAddress().getAddressLine2());
address.setCity(myUser.getHeadquartersAddress().getCity());
address.setCountry(myUser.getHeadquartersAddress().getCountry());
address.setRegion(myUser.getHeadquartersAddress().getRegion());
address.setPostalCode(myUser.getHeadquartersAddress().getPostalCode());
birthplace.setCity("Paris");
birthplace.setCountry(CountryIso.FR);
myUbo.setFirstName(myUser.getLegalRepresentativeFirstName());
myUbo.setLastName(myUser.getLegalRepresentativeLastName());
myUbo.setAddress(address);
myUbo.setNationality(CountryIso.FR);
myUbo.setBirthday(336879600);
myUbo.setBirthplace(birthplace);
myUbo.setActive(true);
myUbo.setTag("create-ubo-java");
Ubo createMyUbo = mangopay.getUboDeclarationApi().createUbo(myUser.getId(), myUboDeclaration.getId(), myUbo);
System.out.println(String.format("id: %s", createMyUbo.getId()));
printObjectFields(createMyUbo);
}
private static void printObjectFields(Object obj) {
Class<?> objClass = obj.getClass();
Field[] fields = objClass.getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
try {
Object value = field.get(obj);
if (value instanceof Address
|| value instanceof Birthplace) {
System.out.println(field.getName() + ": ");
printObjectFields(value);
} else {
System.out.println(field.getName() + ": " + value);
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
}
from pprint import pprint
import mangopay
mangopay.client_id='your-client-id'
mangopay.apikey='your-api-key'
from mangopay.api import APIRequest
handler = APIRequest(sandbox=True)
from mangopay.resources import Ubo, UboDeclaration, LegalUser
from mangopay.utils import Address, Birthplace
legal_user = LegalUser(
id = '210760575'
)
user_ubo_declaration = UboDeclaration(
id = '210863422'
)
user_ubo = Ubo(
first_name = “Ellie”,
last_name = “Adams”,
address = Address(
address_line_1 = ’23 Brook Road’,
city = 'London',
postal_code = 'NE1 0AA',
country = 'GB',
),
nationality = 'GB',
birthday = 336672000,
birthplace = Birthplace(
city = 'London',
country = 'GB'
),
user = legal_user,
ubo_declaration = user_ubo_declaration,
isActive = True
)
create_ubo = user_ubo.save()
pprint(create_ubo)
using MangoPay.SDK;
using MangoPay.SDK.Entities;
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
MangoPayApi api = new MangoPayApi();
api.Config.ClientId = "your-client-id";
api.Config.ClientPassword = "your-api-key";
var userId = "user_m_01HYJVHY77NDDM97TQP57W87MH";
var uboDeclarationId = "ubo_m_01J2XHAXK7VCMMNX6MVGCGAE60";
var ubo = new UboPostDTO (
"Best",
"best",
new Address {
AddressLine1 = "12032 Wiza Way",
City = "Paris",
Region = "Île-de-France",
PostalCode = "75001",
Country = CountryIso.FR,
},
CountryIso.FR,
new DateTime(1980, 3, 15),
new Birthplace
{
City = "Paris",
Country = CountryIso.FR
}
);
var createUbo = await api.UboDeclarations.CreateUboAsync(ubo, userId, uboDeclarationId);
string prettyPrint = JsonConvert.SerializeObject(createUbo, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
{
"Id": "ubo_m_01JH7TS5ZHW3R501ACJEKD5G39",
"CreationDate": 1736503498,
"LastName": "Effertz",
"FirstName": "Michaela",
"Birthday": 652117514,
"Nationality": "FR",
"Address": {
"AddressLine1": "804 Hane Mountains",
"AddressLine2": "Adriel Overpass",
"City": "Paris",
"Region": "Île-de-France",
"PostalCode": "75001",
"Country": "FR"
},
"Birthplace": {
"City": "Paris",
"Country": "FR"
},
"IsActive": true
}
UBO declarations
Create a UBO
POST
/
v2.01
/
{ClientId}
/
users
/
{UserId}
/
kyc
/
ubodeclarations
/
{UboDeclarationId}
/
ubos
{
"FirstName": "AcceptUBO",
"LastName": "Effertz",
"Birthday": 652117514,
"Nationality": "FR",
"Address": {
"AddressLine1": "804 Hane Mountains",
"AddressLine2": "Adriel Overpass",
"City": "Paris",
"Region": "Île-de-France",
"PostalCode": "75001",
"Country": "FR"
},
"Birthplace": {
"City": "Paris",
"Country": "FR"
}
}
<?php
require_once 'vendor/autoload.php';
use MangoPay\MangoPayApi;
use MangoPay\Libraries\ResponseException as MGPResponseException;
use MangoPay\Libraries\Exception as MGPException;
$api = new MangoPayApi();
$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';
$api->Config->TemporaryFolder = 'tmp/';
try {
$userId = '198557165';
$uboDeclarationId = '198692872';
$ubo = new \MangoPay\Ubo();
$address = new \MangoPay\Address();
$address->AddressLine1 = 'Address line 1';
$address->AddressLine2 = 'Address line 2';
$address->City = 'Paris';
$address->Country = 'FR';
$address->PostalCode = '75000';
$address->Region = 'Region';
$ubo->Address = $address;
$ubo->FirstName = 'AcceptUBO';
$ubo->LastName = 'Doe';
$ubo->Nationality = 'FR';
$ubo->Birthday = mktime(0, 0, 0, 12, 21, 1975);
$Birthplace = new \MangoPay\Birthplace();
$Birthplace->City = 'Paris';
$Birthplace->Country = 'FR';
$ubo->Birthplace = $Birthplace;
$response = $api->UboDeclarations->CreateUbo($userId, $uboDeclarationId, $ubo);
print_r($response);
} catch(MGPResponseException $e) {
print_r($e);
} catch(MGPException $e) {
print_r($e);
}
const mangopayInstance = require('mangopay4-nodejs-sdk')
const mangopay = new mangopayInstance({
clientId: 'your-client-id',
clientApiKey: 'your-api-key',
})
let myUser = {
Id: '170853400',
}
let myUboDeclaration = {
Id: '180932134',
}
let myUbo = {
FirstName: 'AcceptUBO',
LastName: 'Smith',
Address: {
AddressLine1: '669 Ratke Forge',
AddressLine2: 'Schamberger Walk',
City: 'Paris',
Region: 'Île-de-France',
PostalCode: '75001',
Country: 'FR',
},
Nationality: 'FR',
Birthday: 652117514,
Birthplace: {
City: 'Paris',
Country: 'FR',
},
}
const createUbo = async (userId, uboDeclarationId, ubo) => {
return await mangopay.UboDeclarations.createUbo(userId, uboDeclarationId, ubo)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
createUbo(myUser.Id, myUboDeclaration.Id, myUbo)
require 'mangopay'
MangoPay.configure do |client|
client.preproduction = true
client.client_id = 'your-client-id'
client.client_apiKey = 'your-api-key'
client.log_file = File.join(Dir.pwd, 'mangopay.log')
end
def createUbo(legalUserId, uboDeclarationId, uboObject)
begin
response = MangoPay::Ubo.create(legalUserId, uboDeclarationId, uboObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to create UBO: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myLegalUser = {
Id: '194338122'
}
myUboDeclaration = {
Id: '194511216'
}
myUbo = {
FirstName: 'AcceptUBO',
LastName: 'Smith',
Address: {
AddressLine1: '669 Ratke Forge',
AddressLine2: 'Schamberger Walk',
City: 'Paris',
Region: 'Île-de-France',
PostalCode: '75001',
Country: 'FR'
},
Nationality: 'FR',
Birthday: 652117514,
Birthplace: {
City: 'Paris',
Country: 'FR'
}
}
createUbo(myLegalUser[:Id], myUboDeclaration[:Id], myUbo)
import com.mangopay.MangoPayApi;
import com.mangopay.core.Address;
import com.mangopay.core.enumerations.CountryIso;
import com.mangopay.entities.Birthplace;
import com.mangopay.entities.Ubo;
import com.mangopay.entities.UboDeclaration;
import com.mangopay.entities.UserLegal;
import java.lang.reflect.Field;
public class CreateUBO {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
UserLegal myUser = mangopay.getUserApi().getLegal("user_m_01HQK53VP687RBSH2Q5TJZRR3S");
UboDeclaration myUboDeclaration = mangopay.getUboDeclarationApi().get("ubo_m_01HRYRPZDB3KXF0QZ6QZ5C95A8");
Ubo myUbo = new Ubo();
Address address = new Address();
Birthplace birthplace = new Birthplace();
address.setAddressLine1(myUser.getHeadquartersAddress().getAddressLine1());
address.setAddressLine2(myUser.getHeadquartersAddress().getAddressLine2());
address.setCity(myUser.getHeadquartersAddress().getCity());
address.setCountry(myUser.getHeadquartersAddress().getCountry());
address.setRegion(myUser.getHeadquartersAddress().getRegion());
address.setPostalCode(myUser.getHeadquartersAddress().getPostalCode());
birthplace.setCity("Paris");
birthplace.setCountry(CountryIso.FR);
myUbo.setFirstName(myUser.getLegalRepresentativeFirstName());
myUbo.setLastName(myUser.getLegalRepresentativeLastName());
myUbo.setAddress(address);
myUbo.setNationality(CountryIso.FR);
myUbo.setBirthday(336879600);
myUbo.setBirthplace(birthplace);
myUbo.setActive(true);
myUbo.setTag("create-ubo-java");
Ubo createMyUbo = mangopay.getUboDeclarationApi().createUbo(myUser.getId(), myUboDeclaration.getId(), myUbo);
System.out.println(String.format("id: %s", createMyUbo.getId()));
printObjectFields(createMyUbo);
}
private static void printObjectFields(Object obj) {
Class<?> objClass = obj.getClass();
Field[] fields = objClass.getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
try {
Object value = field.get(obj);
if (value instanceof Address
|| value instanceof Birthplace) {
System.out.println(field.getName() + ": ");
printObjectFields(value);
} else {
System.out.println(field.getName() + ": " + value);
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
}
from pprint import pprint
import mangopay
mangopay.client_id='your-client-id'
mangopay.apikey='your-api-key'
from mangopay.api import APIRequest
handler = APIRequest(sandbox=True)
from mangopay.resources import Ubo, UboDeclaration, LegalUser
from mangopay.utils import Address, Birthplace
legal_user = LegalUser(
id = '210760575'
)
user_ubo_declaration = UboDeclaration(
id = '210863422'
)
user_ubo = Ubo(
first_name = “Ellie”,
last_name = “Adams”,
address = Address(
address_line_1 = ’23 Brook Road’,
city = 'London',
postal_code = 'NE1 0AA',
country = 'GB',
),
nationality = 'GB',
birthday = 336672000,
birthplace = Birthplace(
city = 'London',
country = 'GB'
),
user = legal_user,
ubo_declaration = user_ubo_declaration,
isActive = True
)
create_ubo = user_ubo.save()
pprint(create_ubo)
using MangoPay.SDK;
using MangoPay.SDK.Entities;
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
MangoPayApi api = new MangoPayApi();
api.Config.ClientId = "your-client-id";
api.Config.ClientPassword = "your-api-key";
var userId = "user_m_01HYJVHY77NDDM97TQP57W87MH";
var uboDeclarationId = "ubo_m_01J2XHAXK7VCMMNX6MVGCGAE60";
var ubo = new UboPostDTO (
"Best",
"best",
new Address {
AddressLine1 = "12032 Wiza Way",
City = "Paris",
Region = "Île-de-France",
PostalCode = "75001",
Country = CountryIso.FR,
},
CountryIso.FR,
new DateTime(1980, 3, 15),
new Birthplace
{
City = "Paris",
Country = CountryIso.FR
}
);
var createUbo = await api.UboDeclarations.CreateUboAsync(ubo, userId, uboDeclarationId);
string prettyPrint = JsonConvert.SerializeObject(createUbo, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
{
"Id": "ubo_m_01JH7TS5ZHW3R501ACJEKD5G39",
"CreationDate": 1736503498,
"LastName": "Effertz",
"FirstName": "Michaela",
"Birthday": 652117514,
"Nationality": "FR",
"Address": {
"AddressLine1": "804 Hane Mountains",
"AddressLine2": "Adriel Overpass",
"City": "Paris",
"Region": "Île-de-France",
"PostalCode": "75001",
"Country": "FR"
},
"Birthplace": {
"City": "Paris",
"Country": "FR"
},
"IsActive": true
}
Caution – Legacy endpoints being superseded by the hosted KYC/KYB solutionMangopay’s hosted KYC/KYB solution is becoming mandatory for all platforms, and allows Legal Users to declare and verify all beneficial owners in the same IDV Session object.The criteria defining beneficial owners remain the same.
FirstName of the first UBO to simulate the outcome (Status) of the declaration after submission:
AcceptUBOforVALIDATEDRefusedUBOforREFUSEDIncompleteUBOforINCOMPLETE
Path parameters
string
required
The unique identifier of the user.
string
required
The unique identifier of the UBO Declaration.
Body parameters
string
required
Max. length: 100 charactersThe last name of the beneficial owner.
string
required
Max. length: 100 charactersThe first name of the beneficial owner.
Unix timestamp
required
The date of birth of the beneficial owner.Note: This is a Unix timestamp in UTC. Ensure you convert your timezone to UTC to avoid midnight being interpreted as the day before.
string
required
Format: Two-letter country code (ISO 3166-1 alpha-2 format)The nationality of the beneficial owner.
object
required
The postal address of the beneficial owner.
Show properties
Show properties
string
required
Max. length: 255 charactersThe first line of the address.
string
Max. length: 255 charactersThe second line of the address.
string
required
Max. length: 255 charactersThe city of the address.
string
Max. length: 255 charactersRequired if
Country is US, CA, or MX.The region of the address.string
required
Max. length: 255 charactersThe postal code of the address. The postal code can contain the following characters: alphanumeric, dashes, and spaces.
string
required
Format: Two-letter country code (ISO 3166-1 alpha-2 format)The country of the address.
object
required
Information about the beneficial owner’s place of birth.
Show properties
Show properties
string
required
The city in which the beneficial owner was born.
string
required
Format: Two-letter country code (ISO 3166-1 alpha-2 format)The country in which the beneficial owner was born.
Responses
200
200
string
Max length: 128 characters (see data formats for details)The unique identifier of the object.
Unix timestamp
The date and time at which the object was created.
string
Max. length: 100 charactersThe last name of the beneficial owner.
string
Max. length: 100 charactersThe first name of the beneficial owner.
Unix timestamp
The date of birth of the beneficial owner.Note: This is a Unix timestamp in UTC. Ensure you convert your timezone to UTC to avoid midnight being interpreted as the day before.
string
The nationality of the beneficial owner.
object
The postal address of the beneficial owner.
Show properties
Show properties
string
Max. length: 255 charactersThe first line of the address.
string
Max. length: 255 charactersThe second line of the address.
string
Max. length: 255 charactersThe city of the address.
string
Max. length: 255 charactersThe region of the address. This field is optional except if the
Country is US, CA, or MX.string
Max. length: 255 charactersThe postal code of the address. The postal code can contain the following characters: alphanumeric, dashes, and spaces.
string
Format: Two-letter country code (ISO 3166-1 alpha-2 format)The country of the address.
object
Information about the beneficial owner’s place of birth.
Show properties
Show properties
string
The city in which the beneficial owner was born.
string
Format: Two-letter country code (ISO 3166-1 alpha-2 format)The country in which the beneficial owner was born.
boolean
Whether or not the UBO is considered in the declaration. To disregard a UBO, this parameter must be set to
false. This action is irreversible.400 - Max 15 UBOs per declaration
400 - Max 15 UBOs per declaration
{
"Message": "You can not create more than 15 UBO for a declaration",
"Type": "invalid_action",
"Id": "f5c1f9c7-bafa-4fe9-b5b1-2b005d0e6f8a",
"Date": 1698759679.0,
"errors": null
}
400 - Region required if Country is US, CA, MX
400 - Region required if Country is US, CA, MX
{
"Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
"Type": "param_error",
"Id": "2951739b-416e-43a4-a40b-8e8d6ba52719",
"Date": 1717664987.0,
"errors": {
"Region": "The Region is a required field for this Country"
}
}
{
"Id": "ubo_m_01JH7TS5ZHW3R501ACJEKD5G39",
"CreationDate": 1736503498,
"LastName": "Effertz",
"FirstName": "Michaela",
"Birthday": 652117514,
"Nationality": "FR",
"Address": {
"AddressLine1": "804 Hane Mountains",
"AddressLine2": "Adriel Overpass",
"City": "Paris",
"Region": "Île-de-France",
"PostalCode": "75001",
"Country": "FR"
},
"Birthplace": {
"City": "Paris",
"Country": "FR"
},
"IsActive": true
}
{
"FirstName": "AcceptUBO",
"LastName": "Effertz",
"Birthday": 652117514,
"Nationality": "FR",
"Address": {
"AddressLine1": "804 Hane Mountains",
"AddressLine2": "Adriel Overpass",
"City": "Paris",
"Region": "Île-de-France",
"PostalCode": "75001",
"Country": "FR"
},
"Birthplace": {
"City": "Paris",
"Country": "FR"
}
}
<?php
require_once 'vendor/autoload.php';
use MangoPay\MangoPayApi;
use MangoPay\Libraries\ResponseException as MGPResponseException;
use MangoPay\Libraries\Exception as MGPException;
$api = new MangoPayApi();
$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';
$api->Config->TemporaryFolder = 'tmp/';
try {
$userId = '198557165';
$uboDeclarationId = '198692872';
$ubo = new \MangoPay\Ubo();
$address = new \MangoPay\Address();
$address->AddressLine1 = 'Address line 1';
$address->AddressLine2 = 'Address line 2';
$address->City = 'Paris';
$address->Country = 'FR';
$address->PostalCode = '75000';
$address->Region = 'Region';
$ubo->Address = $address;
$ubo->FirstName = 'AcceptUBO';
$ubo->LastName = 'Doe';
$ubo->Nationality = 'FR';
$ubo->Birthday = mktime(0, 0, 0, 12, 21, 1975);
$Birthplace = new \MangoPay\Birthplace();
$Birthplace->City = 'Paris';
$Birthplace->Country = 'FR';
$ubo->Birthplace = $Birthplace;
$response = $api->UboDeclarations->CreateUbo($userId, $uboDeclarationId, $ubo);
print_r($response);
} catch(MGPResponseException $e) {
print_r($e);
} catch(MGPException $e) {
print_r($e);
}
const mangopayInstance = require('mangopay4-nodejs-sdk')
const mangopay = new mangopayInstance({
clientId: 'your-client-id',
clientApiKey: 'your-api-key',
})
let myUser = {
Id: '170853400',
}
let myUboDeclaration = {
Id: '180932134',
}
let myUbo = {
FirstName: 'AcceptUBO',
LastName: 'Smith',
Address: {
AddressLine1: '669 Ratke Forge',
AddressLine2: 'Schamberger Walk',
City: 'Paris',
Region: 'Île-de-France',
PostalCode: '75001',
Country: 'FR',
},
Nationality: 'FR',
Birthday: 652117514,
Birthplace: {
City: 'Paris',
Country: 'FR',
},
}
const createUbo = async (userId, uboDeclarationId, ubo) => {
return await mangopay.UboDeclarations.createUbo(userId, uboDeclarationId, ubo)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
createUbo(myUser.Id, myUboDeclaration.Id, myUbo)
require 'mangopay'
MangoPay.configure do |client|
client.preproduction = true
client.client_id = 'your-client-id'
client.client_apiKey = 'your-api-key'
client.log_file = File.join(Dir.pwd, 'mangopay.log')
end
def createUbo(legalUserId, uboDeclarationId, uboObject)
begin
response = MangoPay::Ubo.create(legalUserId, uboDeclarationId, uboObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to create UBO: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myLegalUser = {
Id: '194338122'
}
myUboDeclaration = {
Id: '194511216'
}
myUbo = {
FirstName: 'AcceptUBO',
LastName: 'Smith',
Address: {
AddressLine1: '669 Ratke Forge',
AddressLine2: 'Schamberger Walk',
City: 'Paris',
Region: 'Île-de-France',
PostalCode: '75001',
Country: 'FR'
},
Nationality: 'FR',
Birthday: 652117514,
Birthplace: {
City: 'Paris',
Country: 'FR'
}
}
createUbo(myLegalUser[:Id], myUboDeclaration[:Id], myUbo)
import com.mangopay.MangoPayApi;
import com.mangopay.core.Address;
import com.mangopay.core.enumerations.CountryIso;
import com.mangopay.entities.Birthplace;
import com.mangopay.entities.Ubo;
import com.mangopay.entities.UboDeclaration;
import com.mangopay.entities.UserLegal;
import java.lang.reflect.Field;
public class CreateUBO {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
UserLegal myUser = mangopay.getUserApi().getLegal("user_m_01HQK53VP687RBSH2Q5TJZRR3S");
UboDeclaration myUboDeclaration = mangopay.getUboDeclarationApi().get("ubo_m_01HRYRPZDB3KXF0QZ6QZ5C95A8");
Ubo myUbo = new Ubo();
Address address = new Address();
Birthplace birthplace = new Birthplace();
address.setAddressLine1(myUser.getHeadquartersAddress().getAddressLine1());
address.setAddressLine2(myUser.getHeadquartersAddress().getAddressLine2());
address.setCity(myUser.getHeadquartersAddress().getCity());
address.setCountry(myUser.getHeadquartersAddress().getCountry());
address.setRegion(myUser.getHeadquartersAddress().getRegion());
address.setPostalCode(myUser.getHeadquartersAddress().getPostalCode());
birthplace.setCity("Paris");
birthplace.setCountry(CountryIso.FR);
myUbo.setFirstName(myUser.getLegalRepresentativeFirstName());
myUbo.setLastName(myUser.getLegalRepresentativeLastName());
myUbo.setAddress(address);
myUbo.setNationality(CountryIso.FR);
myUbo.setBirthday(336879600);
myUbo.setBirthplace(birthplace);
myUbo.setActive(true);
myUbo.setTag("create-ubo-java");
Ubo createMyUbo = mangopay.getUboDeclarationApi().createUbo(myUser.getId(), myUboDeclaration.getId(), myUbo);
System.out.println(String.format("id: %s", createMyUbo.getId()));
printObjectFields(createMyUbo);
}
private static void printObjectFields(Object obj) {
Class<?> objClass = obj.getClass();
Field[] fields = objClass.getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
try {
Object value = field.get(obj);
if (value instanceof Address
|| value instanceof Birthplace) {
System.out.println(field.getName() + ": ");
printObjectFields(value);
} else {
System.out.println(field.getName() + ": " + value);
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
}
from pprint import pprint
import mangopay
mangopay.client_id='your-client-id'
mangopay.apikey='your-api-key'
from mangopay.api import APIRequest
handler = APIRequest(sandbox=True)
from mangopay.resources import Ubo, UboDeclaration, LegalUser
from mangopay.utils import Address, Birthplace
legal_user = LegalUser(
id = '210760575'
)
user_ubo_declaration = UboDeclaration(
id = '210863422'
)
user_ubo = Ubo(
first_name = “Ellie”,
last_name = “Adams”,
address = Address(
address_line_1 = ’23 Brook Road’,
city = 'London',
postal_code = 'NE1 0AA',
country = 'GB',
),
nationality = 'GB',
birthday = 336672000,
birthplace = Birthplace(
city = 'London',
country = 'GB'
),
user = legal_user,
ubo_declaration = user_ubo_declaration,
isActive = True
)
create_ubo = user_ubo.save()
pprint(create_ubo)
using MangoPay.SDK;
using MangoPay.SDK.Entities;
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
MangoPayApi api = new MangoPayApi();
api.Config.ClientId = "your-client-id";
api.Config.ClientPassword = "your-api-key";
var userId = "user_m_01HYJVHY77NDDM97TQP57W87MH";
var uboDeclarationId = "ubo_m_01J2XHAXK7VCMMNX6MVGCGAE60";
var ubo = new UboPostDTO (
"Best",
"best",
new Address {
AddressLine1 = "12032 Wiza Way",
City = "Paris",
Region = "Île-de-France",
PostalCode = "75001",
Country = CountryIso.FR,
},
CountryIso.FR,
new DateTime(1980, 3, 15),
new Birthplace
{
City = "Paris",
Country = CountryIso.FR
}
);
var createUbo = await api.UboDeclarations.CreateUboAsync(ubo, userId, uboDeclarationId);
string prettyPrint = JsonConvert.SerializeObject(createUbo, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
Was this page helpful?
⌘I