Skip to main content
The ApiCards class provides methods to retrieve and manage registered card information.

Methods

Get

Get a card by its ID.
public function Get($cardId)
cardId
string
required
The unique identifier of the card
Returns: \MangoPay\Card - The Card object Example:
$card = $api->Cards->Get('card_123456');

Update

Update a card’s properties (typically to deactivate it).
public function Update($card)
card
\MangoPay\Card
required
The Card object to update (must include Id)
Returns: \MangoPay\Card - The updated Card object Example:
$card = $api->Cards->Get('card_123456');
$card->Active = false;
$result = $api->Cards->Update($card);

GetByFingerprint

Get a list of cards with the same fingerprint. The fingerprint is a hash uniquely generated per 16-digit card number.
public function GetByFingerprint($fingerprint, & $pagination = null, $sorting = null)
fingerprint
string
required
The fingerprint hash of the card
pagination
\MangoPay\Pagination
Pagination object (passed by reference)
sorting
\MangoPay\Sorting
Sorting options
Returns: \MangoPay\Card[] - Array of Card objects Example:
$pagination = new \MangoPay\Pagination();
$cards = $api->Cards->GetByFingerprint('abc123def456', $pagination);

GetPreAuthorizations

Get all pre-authorizations for a specific card.
public function GetPreAuthorizations($cardId, $pagination = null, $filter = null, $sorting = null)
cardId
string
required
The ID of the card
pagination
\MangoPay\Pagination
Pagination object
filter
\MangoPay\FilterPreAuthorizations
Filtering options
sorting
\MangoPay\Sorting
Sorting options
Returns: \MangoPay\CardPreAuthorization[] - Array of CardPreAuthorization objects Example:
$preAuths = $api->Cards->GetPreAuthorizations('card_123456');

GetTransactions

Retrieve a list of transactions for a specific card.
public function GetTransactions($cardId, & $pagination = null, $filter = null, $sorting = null)
cardId
string
required
The ID of the card
pagination
\MangoPay\Pagination
Pagination object (passed by reference)
filter
\MangoPay\FilterTransactions
Filtering options
sorting
\MangoPay\Sorting
Sorting options
Returns: \MangoPay\Transaction[] - Array of Transaction objects Example:
$pagination = new \MangoPay\Pagination();
$transactions = $api->Cards->GetTransactions('card_123456', $pagination);

ValidateCard

Validate a card.
public function ValidateCard($cardId, $cardValidation)
cardId
string
required
The ID of the card to validate
cardValidation
\MangoPay\CardValidation
required
The card validation object
Returns: \MangoPay\CardValidation Example:
$validation = new \MangoPay\CardValidation();
$validation->SecureModeReturnURL = 'https://example.com/return';
$result = $api->Cards->ValidateCard('card_123456', $validation);

GetCardValidation

Get a card validation.
public function GetCardValidation($cardId, $cardValidationId)
cardId
string
required
The ID of the card
cardValidationId
string
required
The ID of the card validation
Returns: \MangoPay\CardValidation Example:
$validation = $api->Cards->GetCardValidation('card_123456', 'validation_123');

GetTransactionsByFingerprint

Get all transactions for cards with a specific fingerprint.
public function GetTransactionsByFingerprint($fingerprint, $filter = null, $pagination = null, $sorting = null)
fingerprint
string
required
The card fingerprint hash
filter
\MangoPay\FilterTransactions
Filtering options
pagination
\MangoPay\Pagination
Pagination object
sorting
\MangoPay\Sorting
Sorting options
Returns: \MangoPay\Transaction[] - Array of Transaction objects Example:
$transactions = $api->Cards->GetTransactionsByFingerprint('abc123def456');

Card Entity

The Card entity represents a registered payment card.

Properties

Id
string
The unique identifier of the card
CreationDate
int
Unix timestamp of when the card was registered
Tag
string
Custom data for your use
UserId
string
The ID of the user who owns the card
ExpirationDate
string
The expiration date in MMYY format
Alias
string
An obfuscated version of the card number (e.g., “497010XXXXXX0487”)
CardProvider
string
The card provider: CB, VISA, MASTERCARD, AMEX, etc.
CardType
string
The type of card: CB_VISA_MASTERCARD, DINERS, MASTERPASS, MAESTRO, P24, IDEAL, etc.
Product
string
Additional product information about the card
BankCode
string
The bank code (BIN) of the card
Country
string
The country where the card was issued (ISO 3166-1 alpha-2 format)
Active
bool
Whether the card is active and can be used for payments
Currency
string
The currency of the card (ISO 4217 format)
Validity
string
The validity status: UNKNOWN, VALID, INVALID
Fingerprint
string
A unique hash generated per 16-digit card number
CardHolderName
string
The cardholder’s name as shown on the payment card

Usage Example

// Get a card
$card = $api->Cards->Get('card_123456');

echo "Card: " . $card->Alias . "\n";
echo "Expires: " . $card->ExpirationDate . "\n";
echo "Active: " . ($card->Active ? 'Yes' : 'No') . "\n";

// Deactivate a card
if ($card->Active) {
    $card->Active = false;
    $updatedCard = $api->Cards->Update($card);
    echo "Card deactivated\n";
}

// Get all transactions for the card
$pagination = new \MangoPay\Pagination();
$transactions = $api->Cards->GetTransactions($card->Id, $pagination);

foreach ($transactions as $transaction) {
    echo "Transaction: " . $transaction->Id . " - " . $transaction->Status . "\n";
}

Build docs developers (and LLMs) love