<?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';
$response = $api->Users->GetCards($userId);
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: '146476890',
}
const listUserCards = async (userId) => {
return await mangopay.Users.getCards(userId)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
listUserCards(user.Id)
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 listUserCards(userId)
begin
response = MangoPay::User.cards(userId)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to fetch cards for the user: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myUser = {
Id: '146476890'
}
listUserCards(myUser[:Id])
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.entities.Card;
import java.util.List;
public class ListUserCards {
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_01HT2NFK7Z2BRQNGNHMY30VVTT";
List<Card> cards = mangopay.getUserApi().getCards(userId, null, null);
for (Card card : cards) {
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(card);
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
natural_user = NaturalUser.get('211919260')
cards = natural_user.cards.all()
for card in cards:
pprint(vars(card))
using MangoPay.SDK;
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_01HQK25M6KVHKDV0S36JY9NRKR";
var userCards = await api.Users.GetCardsAsync(userId, null, null);
string prettyPrint = JsonConvert.SerializeObject(userCards, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
[
{
"ExpirationDate": "1229",
"Alias": "497010XXXXXX8183",
"CardType": "CB_VISA_MASTERCARD",
"CardProvider": "VISA",
"Country": "FRA",
"Product": "I",
"BankCode": "unknown",
"Active": true,
"Currency": "EUR",
"Validity": "UNKNOWN",
"UserId": "user_m_01HWWPNMR93ASQYJEH6XVDW44T",
"Id": "card_m_01HXVD91R8QEDY7MYC8TX9R9M8",
"Tag": null,
"CreationDate": 1715685590,
"Fingerprint": "48d63bbcfc2c47fcbc19df35e47b2f8d",
"CardHolderName": "Alex Smith"
},
{
"ExpirationDate": "0626",
"Alias": "497010XXXXXX1119",
"CardType": "CB_VISA_MASTERCARD",
"CardProvider": "VISA",
"Country": "FRA",
"Product": "I",
"BankCode": "unknown",
"Active": true,
"Currency": "EUR",
"Validity": "UNKNOWN",
"UserId": "user_m_01HWWPNMR93ASQYJEH6XVDW44T",
"Id": "card_m_01HXVF4VAM59ZT3FT42T1ZH35Y",
"Tag": null,
"CreationDate": 1715687550,
"Fingerprint": "36c74d2e60ba474eab6d6f6d46a642b0",
"CardHolderName": "Jody Smith"
}
]
Cards
List Cards for a User
GET
/
v2.01
/
{ClientId}
/
users
/
{UserId}
/
cards
<?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';
$response = $api->Users->GetCards($userId);
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: '146476890',
}
const listUserCards = async (userId) => {
return await mangopay.Users.getCards(userId)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
listUserCards(user.Id)
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 listUserCards(userId)
begin
response = MangoPay::User.cards(userId)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to fetch cards for the user: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myUser = {
Id: '146476890'
}
listUserCards(myUser[:Id])
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.entities.Card;
import java.util.List;
public class ListUserCards {
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_01HT2NFK7Z2BRQNGNHMY30VVTT";
List<Card> cards = mangopay.getUserApi().getCards(userId, null, null);
for (Card card : cards) {
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(card);
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
natural_user = NaturalUser.get('211919260')
cards = natural_user.cards.all()
for card in cards:
pprint(vars(card))
using MangoPay.SDK;
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_01HQK25M6KVHKDV0S36JY9NRKR";
var userCards = await api.Users.GetCardsAsync(userId, null, null);
string prettyPrint = JsonConvert.SerializeObject(userCards, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
[
{
"ExpirationDate": "1229",
"Alias": "497010XXXXXX8183",
"CardType": "CB_VISA_MASTERCARD",
"CardProvider": "VISA",
"Country": "FRA",
"Product": "I",
"BankCode": "unknown",
"Active": true,
"Currency": "EUR",
"Validity": "UNKNOWN",
"UserId": "user_m_01HWWPNMR93ASQYJEH6XVDW44T",
"Id": "card_m_01HXVD91R8QEDY7MYC8TX9R9M8",
"Tag": null,
"CreationDate": 1715685590,
"Fingerprint": "48d63bbcfc2c47fcbc19df35e47b2f8d",
"CardHolderName": "Alex Smith"
},
{
"ExpirationDate": "0626",
"Alias": "497010XXXXXX1119",
"CardType": "CB_VISA_MASTERCARD",
"CardProvider": "VISA",
"Country": "FRA",
"Product": "I",
"BankCode": "unknown",
"Active": true,
"Currency": "EUR",
"Validity": "UNKNOWN",
"UserId": "user_m_01HWWPNMR93ASQYJEH6XVDW44T",
"Id": "card_m_01HXVF4VAM59ZT3FT42T1ZH35Y",
"Tag": null,
"CreationDate": 1715687550,
"Fingerprint": "36c74d2e60ba474eab6d6f6d46a642b0",
"CardHolderName": "Jody Smith"
}
]
Query parameters
boolean
Whether the card is active or not.
Path parameters
string
required
The unique identifier of the user.
Responses
200
200
array
The list of the cards created by the platform.
Show properties
Show properties
object
The card object created by the platform.
Show properties
Show properties
string
Format: “MMYY”The expiration date of the card.
string
The card number, partially obfuscated.
string
Returned values:
CB_VISA_MASTERCARD, AMEX, MAESTRO, BCMCDefault value: CB_VISA_MASTERCARDThe type of the card. If not supplied, the default value will be taken into account.string
Allowed values:
CB, VISA, MASTERCARD, AMEX, MAESTRO, BCMC, JCB, DISCOVERThe provider of the card.string
Format: ISO-3166-1 alpha-3 three-letter country code (e.g., “FRA”)The country of the card (which is the same as the country of the issuer).
string
The name of the card issuing bank.
boolean
Whether the card is active or not. Setting this parameter to
false is irreversible and should be done once the pay-in is successful.string
Returned values: The three-letter ISO 4217 code (EUR, GBP, etc.) of a supported currency (depends on feature, contract, and activation settings).The currency of the card.
string
Returned values:
UNKNOWN, VALID, INVALIDWhether the card is valid or not.UNKNOWN– No payment or card validation has been processed, so the validity of the card remains unknown.VALID– The first payment or card validation using the card was processed successfully within 24 hours of the initial card registration.INVALID– The first payment or card validation using the card was attempted and failed, or the status of the corresponding card registration wasCREATEDfor more than 24 hours.
Once a card is set toINVALID, it cannot be set back toVALID. A new card registration will be necessary to make a payment.
string
The unique identifier of the user the card belongs to.
string
The unique identifier of the Card object.
string
Custom data added to this object.
In the case of the Card object, the tag value is inherited from the Card Registration object and is not editable.
In the case of the Card object, the tag value is inherited from the Card Registration object and is not editable.
Unix timestamp
The date and time at which the object was created.
string
The unique representation of the card number. This string can be used to track the card behavior while keeping the card information confidential.
[
{
"ExpirationDate": "1229",
"Alias": "497010XXXXXX8183",
"CardType": "CB_VISA_MASTERCARD",
"CardProvider": "VISA",
"Country": "FRA",
"Product": "I",
"BankCode": "unknown",
"Active": true,
"Currency": "EUR",
"Validity": "UNKNOWN",
"UserId": "user_m_01HWWPNMR93ASQYJEH6XVDW44T",
"Id": "card_m_01HXVD91R8QEDY7MYC8TX9R9M8",
"Tag": null,
"CreationDate": 1715685590,
"Fingerprint": "48d63bbcfc2c47fcbc19df35e47b2f8d",
"CardHolderName": "Alex Smith"
},
{
"ExpirationDate": "0626",
"Alias": "497010XXXXXX1119",
"CardType": "CB_VISA_MASTERCARD",
"CardProvider": "VISA",
"Country": "FRA",
"Product": "I",
"BankCode": "unknown",
"Active": true,
"Currency": "EUR",
"Validity": "UNKNOWN",
"UserId": "user_m_01HWWPNMR93ASQYJEH6XVDW44T",
"Id": "card_m_01HXVF4VAM59ZT3FT42T1ZH35Y",
"Tag": null,
"CreationDate": 1715687550,
"Fingerprint": "36c74d2e60ba474eab6d6f6d46a642b0",
"CardHolderName": "Jody Smith"
}
]
<?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';
$response = $api->Users->GetCards($userId);
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: '146476890',
}
const listUserCards = async (userId) => {
return await mangopay.Users.getCards(userId)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
listUserCards(user.Id)
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 listUserCards(userId)
begin
response = MangoPay::User.cards(userId)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to fetch cards for the user: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myUser = {
Id: '146476890'
}
listUserCards(myUser[:Id])
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.entities.Card;
import java.util.List;
public class ListUserCards {
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_01HT2NFK7Z2BRQNGNHMY30VVTT";
List<Card> cards = mangopay.getUserApi().getCards(userId, null, null);
for (Card card : cards) {
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(card);
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
natural_user = NaturalUser.get('211919260')
cards = natural_user.cards.all()
for card in cards:
pprint(vars(card))
using MangoPay.SDK;
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_01HQK25M6KVHKDV0S36JY9NRKR";
var userCards = await api.Users.GetCardsAsync(userId, null, null);
string prettyPrint = JsonConvert.SerializeObject(userCards, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
Was this page helpful?
⌘I