{
"Active": false
}
<?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 {
$card = new \MangoPay\Card();
$card->Id = '198660883';
$card->Active = false;
$response = $api->Cards->Update($card);
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 myCard = {
Id: '156285393',
Active: false,
}
const deactivateCard = async (card) => {
return await mangopay.Cards.update(card)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
deactivateCard(myCard)
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 deactivateCard(cardId, cardObject)
begin
response = MangoPay::Card.update(cardId, cardObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to deactivate card: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myCard = {
Id: '194579926',
Active: false
}
deactivateCard(myCard[:Id], myCard)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.entities.Card;
public class DeactivateCard {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
String cardId = "card_m_01HXYAVH217SC0ARVDHSE0HQJ0";
Card card = mangopay.getCardApi().get(cardId);
Card disableCard = mangopay.getCardApi().disable(card);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(disableCard);
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 Card
user_card = Card(
id = '213601128',
active = False
)
deactive_card = user_card.save()
pprint(deactive_card)
using MangoPay.SDK;
using MangoPay.SDK.Entities.PUT;
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 cardId = "card_m_01J2Y4W2R4RWKVEME5WG180SQ3";
var card = new CardPutDTO
{
Active = false
};
var deactivateCard = await api.Cards.UpdateAsync(card, cardId);
string prettyPrint = JsonConvert.SerializeObject(deactivateCard, 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": "VALID",
"UserId": "user_m_01HZSK5MX04KS9Q7SQSSRGQQ4Q",
"Id": "card_m_01J0KPBMM32MMSET50CZZ3RMVJ",
"Tag": null,
"CreationDate": 1718647902,
"Fingerprint": "48d63bbcfc2c47fcbc19df35e47b2f8d",
"CardHolderName": "ALEX SMITH"
}
Cards
Deactivate or edit a Card
PUT
/
v2.01
/
{ClientId}
/
cards
/
{CardId}
{
"Active": false
}
<?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 {
$card = new \MangoPay\Card();
$card->Id = '198660883';
$card->Active = false;
$response = $api->Cards->Update($card);
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 myCard = {
Id: '156285393',
Active: false,
}
const deactivateCard = async (card) => {
return await mangopay.Cards.update(card)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
deactivateCard(myCard)
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 deactivateCard(cardId, cardObject)
begin
response = MangoPay::Card.update(cardId, cardObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to deactivate card: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myCard = {
Id: '194579926',
Active: false
}
deactivateCard(myCard[:Id], myCard)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.entities.Card;
public class DeactivateCard {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
String cardId = "card_m_01HXYAVH217SC0ARVDHSE0HQJ0";
Card card = mangopay.getCardApi().get(cardId);
Card disableCard = mangopay.getCardApi().disable(card);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(disableCard);
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 Card
user_card = Card(
id = '213601128',
active = False
)
deactive_card = user_card.save()
pprint(deactive_card)
using MangoPay.SDK;
using MangoPay.SDK.Entities.PUT;
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 cardId = "card_m_01J2Y4W2R4RWKVEME5WG180SQ3";
var card = new CardPutDTO
{
Active = false
};
var deactivateCard = await api.Cards.UpdateAsync(card, cardId);
string prettyPrint = JsonConvert.SerializeObject(deactivateCard, 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": "VALID",
"UserId": "user_m_01HZSK5MX04KS9Q7SQSSRGQQ4Q",
"Id": "card_m_01J0KPBMM32MMSET50CZZ3RMVJ",
"Tag": null,
"CreationDate": 1718647902,
"Fingerprint": "48d63bbcfc2c47fcbc19df35e47b2f8d",
"CardHolderName": "ALEX SMITH"
}
This call serves one of two purposes:
- Setting the card as inactive, and thereby disabling it from being used again. This action is irreversible but doesn’t prevent the card being registered again with POST Create a Card Registration.
- Adding the
CardHolderNameto an existing Card object. TheCardHolderNamecannot be modified once added to a Card object. It can also be done during registration with PUT Update a Card Registration, in which case attempting to edit it with this endpoint returns an error.
Warning – Implement card deactivationBecause card information cannot be kept without the end user’s approval, you should implement a way to deactivate the end user’s card systematically when relevant.
Path parameters
string
required
The unique identifier of the Card object, which is returned after updating the Card Registration object with the
RegistrationData.Body parameters
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
Max. length: 45 characters passed to card network, 255 accepted by the APIThe cardholder’s name shown on the payment card. This value is passed to the card network for use in transaction risk analysis.The value should only contain unmarked alphabetic characters (A-Z, a-z), hyphens (-), apostrophes (‘), and spaces. Letters with diacritics (e.g. É, Ü, ẞ), honorifics (e.g. MRS.) and other special characters are not recommended (they are transformed before being sent to the card network).The
CardHolderName is not returned in the Card Registration object; it is added to the Card object.Responses
200
200
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 product type of the card.
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.
string
The unique representation of the card number. This string can be used to track the card behavior while keeping the card information confidential.
string
Max. length: 45 charactersThe cardholder’s name shown on the payment card. This value is passed to the card network for use in transaction risk analysis.
400 - Card is already deactivated
400 - Card is already deactivated
{
"Message": "The card has already been deactivated",
"Type": "card_already_not_active",
"Id": "8ebd2256-e596-4404-8c76-cd14b505d7a4",
"Date": 1690292341.0,
"errors": null
}
400 - CardHolderName cannot be modified once added
400 - CardHolderName cannot be modified once added
{
"Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
"Type": "param_error",
"Id": "b89e7138-7812-486e-be79-ee817e4441ac#1718650010",
"Date": 1718650011,
"errors": {
"cardHolderName": "card holder name already exists"
}
}
400 - CardHolderName must be between 2 and 255 characters long
400 - CardHolderName must be between 2 and 255 characters long
{
"Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
"Type": "param_error",
"Id": "e92e4d2a-81fc-4ca6-9a2b-4b3a0cba57e9",
"Date": 1723036573.0,
"errors": {
"CardHolderName": "The field CardHolderName must be between 2 and 255 characters long."
}
}
{
"ExpirationDate": "1229",
"Alias": "497010XXXXXX8183",
"CardType": "CB_VISA_MASTERCARD",
"CardProvider": "VISA",
"Country": "FRA",
"Product": "I",
"BankCode": "unknown",
"Active": true,
"Currency": "EUR",
"Validity": "VALID",
"UserId": "user_m_01HZSK5MX04KS9Q7SQSSRGQQ4Q",
"Id": "card_m_01J0KPBMM32MMSET50CZZ3RMVJ",
"Tag": null,
"CreationDate": 1718647902,
"Fingerprint": "48d63bbcfc2c47fcbc19df35e47b2f8d",
"CardHolderName": "ALEX SMITH"
}
{
"Active": false
}
<?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 {
$card = new \MangoPay\Card();
$card->Id = '198660883';
$card->Active = false;
$response = $api->Cards->Update($card);
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 myCard = {
Id: '156285393',
Active: false,
}
const deactivateCard = async (card) => {
return await mangopay.Cards.update(card)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
deactivateCard(myCard)
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 deactivateCard(cardId, cardObject)
begin
response = MangoPay::Card.update(cardId, cardObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to deactivate card: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myCard = {
Id: '194579926',
Active: false
}
deactivateCard(myCard[:Id], myCard)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.entities.Card;
public class DeactivateCard {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
String cardId = "card_m_01HXYAVH217SC0ARVDHSE0HQJ0";
Card card = mangopay.getCardApi().get(cardId);
Card disableCard = mangopay.getCardApi().disable(card);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(disableCard);
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 Card
user_card = Card(
id = '213601128',
active = False
)
deactive_card = user_card.save()
pprint(deactive_card)
using MangoPay.SDK;
using MangoPay.SDK.Entities.PUT;
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 cardId = "card_m_01J2Y4W2R4RWKVEME5WG180SQ3";
var card = new CardPutDTO
{
Active = false
};
var deactivateCard = await api.Cards.UpdateAsync(card, cardId);
string prettyPrint = JsonConvert.SerializeObject(deactivateCard, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
Was this page helpful?