{
"OwnerAddress":{
"AddressLine1":"The Oasis",
"AddressLine2":"Rue des plantes",
"City":"Paris",
"Region":"Ile de France",
"PostalCode":"75001",
"Country":"FR"
},
"AccountNumber":"11696419",
"InstitutionNumber":"614",
"BranchCode":"00152",
"BankName":"The Bank",
"OwnerName":"Joe Blogs",
"Tag":"custom meta",
}
<?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 = '146476890';
$bankAccount = new \MangoPay\BankAccount();
$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';
$details = new \MangoPay\BankAccountDetailsCA();
$details->AccountNumber = '11696419';
$details->InstitutionNumber = '614';
$details->BranchCode = '00152';
$details->BankName = 'Bank of Canada';
$bankAccount->OwnerAddress = $address;
$bankAccount->OwnerName = 'Alex Smith';
$bankAccount->Tag = 'Created using Mangopay PHP SDK';
$bankAccount->Type = 'IBAN';
$bankAccount->Details = $details;
$response = $api->Users->CreateBankAccount($userId, $bankAccount);
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 user = {
Id: '165863393',
Address: {
AddressLine1: 'Edgewood Road',
AddressLine2: null,
City: 'Little Rock',
Region: 'IDF',
PostalCode: '75000',
Country: 'FR',
},
FirstName: 'John',
LastName: 'Doe',
}
let bankAccount = {
Type: 'CA',
OwnerName: user.FirstName + '' + user.LastName,
OwnerAddress: user.Address,
AccountNumber: '11696419',
InstitutionNumber: '614',
BranchCode: '00152',
BankName: 'The Bank',
Tag: 'Created using Mangopay NodeJS SDK',
}
const createBankAccount = async (userId, bankAccount) => {
return await mangopay.Users.createBankAccount(userId, bankAccount)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
createBankAccount(user.Id, bankAccount)
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 createCaBankAccount(userId, caBankAccountObject)
begin
response = MangoPay::BankAccount.create(userId, caBankAccountObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to create bank account: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myUser = {
Id: '165863393'
}
myCaBankAccount = {
Type: 'CA',
OwnerName: 'Alex Smith',
OwnerAddress: {
AddressLine1: 'Edgewood Road',
AddressLine2: 'Address line 2',
City: 'Little Rock',
Region: 'IDF',
PostalCode: '75000',
Country: 'FR'
},
AccountNumber: '11696419',
InstitutionNumber: '614',
BranchCode: '00152',
BankName: 'The Bank',
Tag: 'Created using Mangopay Ruby SDK'
}
createCaBankAccount(myUser[:Id], myCaBankAccount)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.core.Address;
import com.mangopay.core.enumerations.BankAccountType;
import com.mangopay.core.enumerations.CountryIso;
import com.mangopay.entities.BankAccount;
import com.mangopay.entities.subentities.BankAccountDetailsCA;
public class CreateCABankAccount {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
var userId = "user_m_01J29D5XMKKNPX72AR5HRV804X";
BankAccountDetailsCA bankAccountDetails = new BankAccountDetailsCA();
bankAccountDetails.setAccountNumber("11696419");
bankAccountDetails.setBankName("The Bank");
bankAccountDetails.setBranchCode("00152");
bankAccountDetails.setInstitutionNumber("614");
Address address = new Address();
address.setAddressLine1("Rue des plantes");
address.setAddressLine2("The Oasis");
address.setCity("FR");
address.setRegion("Ile de France");
address.setPostalCode("75001");
address.setCountry(CountryIso.FR);
BankAccount bankAccount = new BankAccount();
bankAccount.setOwnerName("John Doe");
bankAccount.setDetails(bankAccountDetails);
bankAccount.setOwnerAddress(address);
bankAccount.setType(BankAccountType.CA);
bankAccount.setTag("Created using the Mangopay Java SDK");
BankAccount createBankAccount = mangopay.getUserApi().createBankAccount(userId, bankAccount);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(createBankAccount);
System.out.println(prettyJson);
}
}
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 NaturalUser, BankAccount
from mangopay.utils import Address
natural_user = NaturalUser.get('213753890')
ca_bank_account = BankAccount(
user_id = natural_user.id,
owner_name = f'{natural_user.first_name} {natural_user.last_name}',
owner_address = Address(
address_line_1 = natural_user.address.address_line_1,
address_line_2 = natural_user.address.address_line_2,
city = natural_user.address.city,
region = natural_user.address.region,
postal_code = natural_user.address.postal_code,
country = natural_user.address.country,
),
account_number = '11696419',
institution_number = '614',
branch_code = '00152',
bank_name = 'The Bank',
type = 'CA',
tag = 'Created using the Mangopay Python SDK',
)
create_ca_bank_account = ca_bank_account.save()
pprint(create_ca_bank_account)
using MangoPay.SDK;
using MangoPay.SDK.Entities.GET;
using MangoPay.SDK.Entities.POST;
using MangoPay.SDK.Core.Enumerations;
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 user = await api.Users.GetNaturalAsync("user_m_01J2TZ261WZNDM0ZDRWGDYA4GN");
var accountNumber = "11696419";
var institutionNumber = "614";
var branchCode = "00152";
var bankName = "The Bank";
var CaBankAccount = new BankAccountCaPostDTO(
user.FirstName + " " + user.LastName,
user.Address,
bankName, institutionNumber, branchCode, accountNumber
) {
Tag = "Created using the Mangopay .NET SDK"
};
BankAccountDTO createCaBankAccount = await api.Users.CreateBankAccountCaAsync(user.Id, CaBankAccount);
string prettyPrint = JsonConvert.SerializeObject(createCaBankAccount, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
{
"OwnerAddress":{
"AddressLine1":"The Oasis",
"AddressLine2":"Rue des plantes",
"City":"Paris",
"Region":"Ile de France",
"PostalCode":"75001",
"Country":"FR"
},
"AccountNumber":"11696419",
"InstitutionNumber":"614",
"BranchCode":"00152",
"BankName":"The Bank",
"UserId":"142036728",
"OwnerName":"Joe Blogs",
"Type":"CA",
"Id":"150295080",
"Tag":null,
"CreationDate":1661865058,
"Active":true
}
Bank accounts
Create a CA Bank Account
POST
/
v2.01
/
{ClientId}
/
users
/
{UserId}
/
bankaccounts
/
ca
{
"OwnerAddress":{
"AddressLine1":"The Oasis",
"AddressLine2":"Rue des plantes",
"City":"Paris",
"Region":"Ile de France",
"PostalCode":"75001",
"Country":"FR"
},
"AccountNumber":"11696419",
"InstitutionNumber":"614",
"BranchCode":"00152",
"BankName":"The Bank",
"OwnerName":"Joe Blogs",
"Tag":"custom meta",
}
<?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 = '146476890';
$bankAccount = new \MangoPay\BankAccount();
$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';
$details = new \MangoPay\BankAccountDetailsCA();
$details->AccountNumber = '11696419';
$details->InstitutionNumber = '614';
$details->BranchCode = '00152';
$details->BankName = 'Bank of Canada';
$bankAccount->OwnerAddress = $address;
$bankAccount->OwnerName = 'Alex Smith';
$bankAccount->Tag = 'Created using Mangopay PHP SDK';
$bankAccount->Type = 'IBAN';
$bankAccount->Details = $details;
$response = $api->Users->CreateBankAccount($userId, $bankAccount);
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 user = {
Id: '165863393',
Address: {
AddressLine1: 'Edgewood Road',
AddressLine2: null,
City: 'Little Rock',
Region: 'IDF',
PostalCode: '75000',
Country: 'FR',
},
FirstName: 'John',
LastName: 'Doe',
}
let bankAccount = {
Type: 'CA',
OwnerName: user.FirstName + '' + user.LastName,
OwnerAddress: user.Address,
AccountNumber: '11696419',
InstitutionNumber: '614',
BranchCode: '00152',
BankName: 'The Bank',
Tag: 'Created using Mangopay NodeJS SDK',
}
const createBankAccount = async (userId, bankAccount) => {
return await mangopay.Users.createBankAccount(userId, bankAccount)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
createBankAccount(user.Id, bankAccount)
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 createCaBankAccount(userId, caBankAccountObject)
begin
response = MangoPay::BankAccount.create(userId, caBankAccountObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to create bank account: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myUser = {
Id: '165863393'
}
myCaBankAccount = {
Type: 'CA',
OwnerName: 'Alex Smith',
OwnerAddress: {
AddressLine1: 'Edgewood Road',
AddressLine2: 'Address line 2',
City: 'Little Rock',
Region: 'IDF',
PostalCode: '75000',
Country: 'FR'
},
AccountNumber: '11696419',
InstitutionNumber: '614',
BranchCode: '00152',
BankName: 'The Bank',
Tag: 'Created using Mangopay Ruby SDK'
}
createCaBankAccount(myUser[:Id], myCaBankAccount)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.core.Address;
import com.mangopay.core.enumerations.BankAccountType;
import com.mangopay.core.enumerations.CountryIso;
import com.mangopay.entities.BankAccount;
import com.mangopay.entities.subentities.BankAccountDetailsCA;
public class CreateCABankAccount {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
var userId = "user_m_01J29D5XMKKNPX72AR5HRV804X";
BankAccountDetailsCA bankAccountDetails = new BankAccountDetailsCA();
bankAccountDetails.setAccountNumber("11696419");
bankAccountDetails.setBankName("The Bank");
bankAccountDetails.setBranchCode("00152");
bankAccountDetails.setInstitutionNumber("614");
Address address = new Address();
address.setAddressLine1("Rue des plantes");
address.setAddressLine2("The Oasis");
address.setCity("FR");
address.setRegion("Ile de France");
address.setPostalCode("75001");
address.setCountry(CountryIso.FR);
BankAccount bankAccount = new BankAccount();
bankAccount.setOwnerName("John Doe");
bankAccount.setDetails(bankAccountDetails);
bankAccount.setOwnerAddress(address);
bankAccount.setType(BankAccountType.CA);
bankAccount.setTag("Created using the Mangopay Java SDK");
BankAccount createBankAccount = mangopay.getUserApi().createBankAccount(userId, bankAccount);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(createBankAccount);
System.out.println(prettyJson);
}
}
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 NaturalUser, BankAccount
from mangopay.utils import Address
natural_user = NaturalUser.get('213753890')
ca_bank_account = BankAccount(
user_id = natural_user.id,
owner_name = f'{natural_user.first_name} {natural_user.last_name}',
owner_address = Address(
address_line_1 = natural_user.address.address_line_1,
address_line_2 = natural_user.address.address_line_2,
city = natural_user.address.city,
region = natural_user.address.region,
postal_code = natural_user.address.postal_code,
country = natural_user.address.country,
),
account_number = '11696419',
institution_number = '614',
branch_code = '00152',
bank_name = 'The Bank',
type = 'CA',
tag = 'Created using the Mangopay Python SDK',
)
create_ca_bank_account = ca_bank_account.save()
pprint(create_ca_bank_account)
using MangoPay.SDK;
using MangoPay.SDK.Entities.GET;
using MangoPay.SDK.Entities.POST;
using MangoPay.SDK.Core.Enumerations;
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 user = await api.Users.GetNaturalAsync("user_m_01J2TZ261WZNDM0ZDRWGDYA4GN");
var accountNumber = "11696419";
var institutionNumber = "614";
var branchCode = "00152";
var bankName = "The Bank";
var CaBankAccount = new BankAccountCaPostDTO(
user.FirstName + " " + user.LastName,
user.Address,
bankName, institutionNumber, branchCode, accountNumber
) {
Tag = "Created using the Mangopay .NET SDK"
};
BankAccountDTO createCaBankAccount = await api.Users.CreateBankAccountCaAsync(user.Id, CaBankAccount);
string prettyPrint = JsonConvert.SerializeObject(createCaBankAccount, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
{
"OwnerAddress":{
"AddressLine1":"The Oasis",
"AddressLine2":"Rue des plantes",
"City":"Paris",
"Region":"Ile de France",
"PostalCode":"75001",
"Country":"FR"
},
"AccountNumber":"11696419",
"InstitutionNumber":"614",
"BranchCode":"00152",
"BankName":"The Bank",
"UserId":"142036728",
"OwnerName":"Joe Blogs",
"Type":"CA",
"Id":"150295080",
"Tag":null,
"CreationDate":1661865058,
"Active":true
}
Caution - Payouts refused to Bank Accounts created after April 30, 2026Bank Account objects created after April 30, 2026, will not be usable for payouts. External accounts must be registered using the Recipient endpoints and authenticated using SCA.Payouts to Bank Accounts created after May 1, 2026, will fail with the
ResultCode 121018. To resolve this, register the external account using POST Create a Recipient and retry the payout.Note – Replaced by Recipients featureThe Bank Account object and endpoints have been replaced by the Recipients feature, which all platforms should integrate instead.Legacy active Bank Accounts (
Active is true) have been migrated to the new feature and their data is retrievable via the GET View a Recipient endpoint using the same BankAccountId. Read more about legacy bank account migration.Path parameters
The unique identifier of the User (natural or legal) who owns the bank account.
Body parameters
Information about the address of residence of the bank account owner.
Show properties
Show properties
Max. length: 255 charactersThe first line of the address.
Max. length: 255 charactersThe second line of the address.
Max. length: 255 charactersThe city of the address.
Max. length: 255 charactersThe region of the address. This field is optional except if the
Country is US, CA, or MX.Max. length: 255 charactersThe postal code of the address. The postal code can contain the following characters: alphanumeric, dashes, and spaces.
The country of the address.
Format: Digits onlyThe unique number of the bank account (between 7 to 35 digits).
Length: 3 digitsThe 3-digit number assigned to Canadian financial institutions, for CA-type bank accounts.
Length: 5 digitsThe 5-digit number assigned to branches of Canadian financial institutions, for CA-type bank accounts.
Max. length: 50 characters (letters and digits only)The name of the Canadian bank for CA-type bank accounts.
Max. length: 255 charactersThe full name of the owner of the bank account. (Format: FirstName LastName)
Max. length: 255 charactersCustom data that you can add to this object.
For bank accounts, you can use this parameter to identify the bank account by currency or usage (personal or professional for instance).
For bank accounts, you can use this parameter to identify the bank account by currency or usage (personal or professional for instance).
Responses
200
200
Information about the address of residence of the bank account owner.
Show properties
Show properties
Max. length: 255 charactersThe first line of the address.
Max. length: 255 charactersThe second line of the address.
Max. length: 255 charactersThe city of the address.
Max. length: 255 charactersThe region of the address. This field is optional except if the
Country is US, CA, or MX.Max. length: 255 charactersThe postal code of the address. The postal code can contain the following characters: alphanumeric, dashes, and spaces.
Format: Two-letter country code (ISO 3166-1 alpha-2 format)The country of the address.
Format: Digits onlyThe unique number of the bank account (between 7 to 35 digits).
Length: 3 digitsThe 3-digit number assigned to Canadian financial institutions, for CA-type bank accounts.
Length: 5 digitsThe 5-digit number assigned to branches of Canadian financial institutions, for CA-type bank accounts.
Max. length: 50 characters (letters and digits only)The name of the Canadian bank for CA-type bank accounts.
The unique identifier of the User (natural or legal) who owns the bank account.
Max. length: 255 charactersThe full name of the owner of the bank account. (Format: FirstName LastName)
Returned values:
The values are:
IBAN, US, CA, GB, OTHERThe type of the bank account, indicating the country where the real-life account is registeredThe values are:
IBAN– For accounts registered in countries that use IBANUS– For accounts registered in the United StatesCA– For accounts registered in CanadaGB– For accounts registered in the United KingdomOTHER– For accounts registered in countries that do not use IBAN (and are not US, CA, GB)
Max length: 128 characters (see data formats for details)The unique identifier of the object.
Max. length: 255 charactersCustom data that you can add to this object.
For bank accounts, you can use this parameter to identify the bank account by currency or usage (personal or professional for instance).
For bank accounts, you can use this parameter to identify the bank account by currency or usage (personal or professional for instance).
The date and time at which the object was created.
Whether or not the Bank Account is active.
Mangopay automatically sets this parameter to
false if the bank account is closed or does not exist anymore.400 - Missing parameters
400 - Missing parameters
{
"Message":"One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
"Type":"param_error",
"Id":"4ee7cdf4-602a-4d6f-8859-4e7548022abf#1661865189",
"Date":1661865190.0,
"errors":{
"InstitutionNumber":"The InstitutionNumber field is required.",
"BranchCode":"The BranchCode field is required.",
"BankName":"The BankName field is required."
}
}
{
"OwnerAddress":{
"AddressLine1":"The Oasis",
"AddressLine2":"Rue des plantes",
"City":"Paris",
"Region":"Ile de France",
"PostalCode":"75001",
"Country":"FR"
},
"AccountNumber":"11696419",
"InstitutionNumber":"614",
"BranchCode":"00152",
"BankName":"The Bank",
"UserId":"142036728",
"OwnerName":"Joe Blogs",
"Type":"CA",
"Id":"150295080",
"Tag":null,
"CreationDate":1661865058,
"Active":true
}
{
"OwnerAddress":{
"AddressLine1":"The Oasis",
"AddressLine2":"Rue des plantes",
"City":"Paris",
"Region":"Ile de France",
"PostalCode":"75001",
"Country":"FR"
},
"AccountNumber":"11696419",
"InstitutionNumber":"614",
"BranchCode":"00152",
"BankName":"The Bank",
"OwnerName":"Joe Blogs",
"Tag":"custom meta",
}
<?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 = '146476890';
$bankAccount = new \MangoPay\BankAccount();
$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';
$details = new \MangoPay\BankAccountDetailsCA();
$details->AccountNumber = '11696419';
$details->InstitutionNumber = '614';
$details->BranchCode = '00152';
$details->BankName = 'Bank of Canada';
$bankAccount->OwnerAddress = $address;
$bankAccount->OwnerName = 'Alex Smith';
$bankAccount->Tag = 'Created using Mangopay PHP SDK';
$bankAccount->Type = 'IBAN';
$bankAccount->Details = $details;
$response = $api->Users->CreateBankAccount($userId, $bankAccount);
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 user = {
Id: '165863393',
Address: {
AddressLine1: 'Edgewood Road',
AddressLine2: null,
City: 'Little Rock',
Region: 'IDF',
PostalCode: '75000',
Country: 'FR',
},
FirstName: 'John',
LastName: 'Doe',
}
let bankAccount = {
Type: 'CA',
OwnerName: user.FirstName + '' + user.LastName,
OwnerAddress: user.Address,
AccountNumber: '11696419',
InstitutionNumber: '614',
BranchCode: '00152',
BankName: 'The Bank',
Tag: 'Created using Mangopay NodeJS SDK',
}
const createBankAccount = async (userId, bankAccount) => {
return await mangopay.Users.createBankAccount(userId, bankAccount)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
createBankAccount(user.Id, bankAccount)
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 createCaBankAccount(userId, caBankAccountObject)
begin
response = MangoPay::BankAccount.create(userId, caBankAccountObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to create bank account: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myUser = {
Id: '165863393'
}
myCaBankAccount = {
Type: 'CA',
OwnerName: 'Alex Smith',
OwnerAddress: {
AddressLine1: 'Edgewood Road',
AddressLine2: 'Address line 2',
City: 'Little Rock',
Region: 'IDF',
PostalCode: '75000',
Country: 'FR'
},
AccountNumber: '11696419',
InstitutionNumber: '614',
BranchCode: '00152',
BankName: 'The Bank',
Tag: 'Created using Mangopay Ruby SDK'
}
createCaBankAccount(myUser[:Id], myCaBankAccount)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.core.Address;
import com.mangopay.core.enumerations.BankAccountType;
import com.mangopay.core.enumerations.CountryIso;
import com.mangopay.entities.BankAccount;
import com.mangopay.entities.subentities.BankAccountDetailsCA;
public class CreateCABankAccount {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
var userId = "user_m_01J29D5XMKKNPX72AR5HRV804X";
BankAccountDetailsCA bankAccountDetails = new BankAccountDetailsCA();
bankAccountDetails.setAccountNumber("11696419");
bankAccountDetails.setBankName("The Bank");
bankAccountDetails.setBranchCode("00152");
bankAccountDetails.setInstitutionNumber("614");
Address address = new Address();
address.setAddressLine1("Rue des plantes");
address.setAddressLine2("The Oasis");
address.setCity("FR");
address.setRegion("Ile de France");
address.setPostalCode("75001");
address.setCountry(CountryIso.FR);
BankAccount bankAccount = new BankAccount();
bankAccount.setOwnerName("John Doe");
bankAccount.setDetails(bankAccountDetails);
bankAccount.setOwnerAddress(address);
bankAccount.setType(BankAccountType.CA);
bankAccount.setTag("Created using the Mangopay Java SDK");
BankAccount createBankAccount = mangopay.getUserApi().createBankAccount(userId, bankAccount);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(createBankAccount);
System.out.println(prettyJson);
}
}
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 NaturalUser, BankAccount
from mangopay.utils import Address
natural_user = NaturalUser.get('213753890')
ca_bank_account = BankAccount(
user_id = natural_user.id,
owner_name = f'{natural_user.first_name} {natural_user.last_name}',
owner_address = Address(
address_line_1 = natural_user.address.address_line_1,
address_line_2 = natural_user.address.address_line_2,
city = natural_user.address.city,
region = natural_user.address.region,
postal_code = natural_user.address.postal_code,
country = natural_user.address.country,
),
account_number = '11696419',
institution_number = '614',
branch_code = '00152',
bank_name = 'The Bank',
type = 'CA',
tag = 'Created using the Mangopay Python SDK',
)
create_ca_bank_account = ca_bank_account.save()
pprint(create_ca_bank_account)
using MangoPay.SDK;
using MangoPay.SDK.Entities.GET;
using MangoPay.SDK.Entities.POST;
using MangoPay.SDK.Core.Enumerations;
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 user = await api.Users.GetNaturalAsync("user_m_01J2TZ261WZNDM0ZDRWGDYA4GN");
var accountNumber = "11696419";
var institutionNumber = "614";
var branchCode = "00152";
var bankName = "The Bank";
var CaBankAccount = new BankAccountCaPostDTO(
user.FirstName + " " + user.LastName,
user.Address,
bankName, institutionNumber, branchCode, accountNumber
) {
Tag = "Created using the Mangopay .NET SDK"
};
BankAccountDTO createCaBankAccount = await api.Users.CreateBankAccountCaAsync(user.Id, CaBankAccount);
string prettyPrint = JsonConvert.SerializeObject(createCaBankAccount, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
Was this page helpful?
⌘I