curl -X PUT https://api.sandbox.mangopay.com/v2.01/{ClientId}/cardregistrations/{CardRegistrationId} \
-H 'Content-Type: application/json' \
-d '{
"RegistrationData": "data=acIcnwwLleiAvlZUea5VxZlDBkf07H6B9-N7SrRv5Vv7oSLc1hhCdoFX4JxfZL2iUkLIQL3o9ehAOeaXCbc1KFWnr4ySDvkZ--mJxxdF-vw-gzLNe3lvG2loJvmwrDyRNx0xgKTVnyDj15oG8jR88g",
"CardHolderName": "Alex Smith"
}'
{
"RegistrationData": "data=acIcnwwLleiAvlZUea5VxZlDBkf07H6B9-N7SrRv5Vv7oSLc1hhCdoFX4JxfZL2iUkLIQL3o9ehAOeaXCbc1KFWnr4ySDvkZ--mJxxdF-vw-gzLNe3lvG2loJvmwrDyRNx0xgKTVnyDj15oG8jR88g",
"CardHolderName": "Alex 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 {
$cardRegistration = new \MangoPay\CardRegistration();
$cardRegistration->Id = '198660792';
$cardRegistration->RegistrationData = 'data=EwQibNkLWbGepaBektTHQcnk7KxDDpQybRm3BWmKLu4DKdgmC-JI0b4bK9UW5C3u1L4A4AkhT3LJqC3_FAvbwYQXIPvj1ElxL2OIJfvlS3YXlJyOctdX1PGkkgCkgl3j0ftIYwFxOdfmDQ5GtM_cIg';
$response = $api->CardRegistrations->Update($cardRegistration);
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: 'user_m_01HQK25M6KVHKDV0S36JY9NRKR',
}
let userCardRegistration = {
Id: 'cardreg_m_01HRETW28RKJFC8RB9H625RVBD',
UserId: user.Id,
Currency: 'EUR',
CardType: 'CB_VISA_MASTERCARD',
RegistrationData: 'data=acIcnwwLleiAvlZUea5VxT5mw_fK696E0m-dvIdK-KnTCrftajOU7W3fTvYLnKiF68q7RUkmAEL86Wi8c0oX7wHD6vfA3lowMRD7SvlcCCl6Xl3Esy_DIyBzznraJzm70ftIYwFxOdfmDQ5GtM_cIg',
CardHolderName: 'Alex Smith',
}
const updateCardRegistration = async(cardRegistration) => {
return await mangopay.CardRegistrations.update(cardRegistration)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
updateCardRegistration(userCardRegistration)
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 updateCardRegistration(card_registration_id, params)
begin
response = MangoPay::CardRegistration.update(card_registration_id, params)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed : #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
params = {
"RegistrationData": "data=acIcnwwLleiAvlZUea5VxW4I8X8iCT0M1Z4j5kgkKf4KQzh0G0UQLpozaVZwyqUOQJM3kYVZIDlCIp6vDysQ6F0qIb1486gpwf_EGW9fTllJlstGZZo5YuZ8RWz_814ONx0xgKTVnyDj15oG8jR88g",
"CardHolderName": "ALEX SMITH"
}
updateCardRegistration("cardreg_m_01J2C8JM4YHV1Z57RKRBK97B0Y", params)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.entities.CardRegistration;
public class UpdateCardRegistration {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
CardRegistration cardReg = mangopay.getCardRegistrationApi().get("cardreg_m_01HXY9VZN4J1TERYG1BNPDHENN");
cardReg.setRegistrationData("data=acIcnwwLleiAvlZUea5VxfRSGv9nDzXcMqBpL3byXCz_GKPvDDem-KDL6Tf_yaRZBYWP-ghC9O56GivqHUjmwR4Dq2M_FO0KhF_NWnd-fb5L_0I49NvwmWI1uPP5WuzcNx0xgKTVnyDj15oG8jR88g");
CardRegistration updateCardRegistration = mangopay.getCardRegistrationApi().update(cardReg);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(updateCardRegistration);
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 CardRegistration
user_card_registration = CardRegistration(
id = '213600973',
registration_data = 'data=R7hxMYui4h4rBkaNwbiH1DvQL35Y-goFSYQI384_jNsDngV32O95BVgk3Pg7vqU_mZIFFs4gFl24VlSBXNiuoi4Be_uieN3jEegz77g8ElaToz_b7S91YuROvHH0w6J40ftIYwFxOdfmDQ5GtM_cIg',
card_holder_name = 'Alex Smith'
)
update_card_registration = user_card_registration.save()
pprint(update_card_registration)
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 cardRegistrationId = "cardreg_m_01J2Y3ZTFTZSKB5XWAKCNMPWFC";
var registrationData = "data=qc_ShKapgXF-A2t_OC72Ktbe2pgMGnalwOa7YhCbIDdpW0cgKABxbhU6R6yVTVJKZpvPpkvQy0HS6G3zrpUyXboAD2d1WLU2-FKrT2dHpcH9c8YxZgpdCs4Z6c6u-qDT0ftIYwFxOdfmDQ5GtM_cIg";
var cardRegistration = new CardRegistrationPutDTO
{
RegistrationData = registrationData,
Tag = "Updated using the Mangopay .NET SDK"
};
var updateCardRegistration = await api.CardRegistrations.UpdateAsync(cardRegistration, cardRegistrationId);
string prettyPrint = JsonConvert.SerializeObject(updateCardRegistration, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
{
"Id": "cardreg_wt_11ed4694-d244-4bd1-92fb-dc473c99a9d4",
"Tag": null,
"CreationDate": 1726239226,
"UserId": "user_m_01J7KACBPAV7XAF8AH9BDCJPRS",
"AccessKey": "ehvrHoPE6FpjCCAgmNvg",
"PreregistrationData": "lhOJ6CFiDJPCXViyHjfcayh92nouB3AAaB5yqiLCBT6yjkLPCptmxsUdfffAc6EE4uj9AuSfmwbdfKN3BMechzUU3Gz8ectEx70TDeupudr",
"RegistrationData": "data=acIcnwwLleiAvlZUea5VxYT1eCIn3MER8jyZXr-p8Bzb4Rm8GIA0MQtPs2NL7zPzPO_I7EjQm-m92V909JUL6KT-PmPzJfAQZV_8PIz6wKvjorGNaNd8Mg1rqN6eBpS5Nx0xgKTVnyDj15oG8jR875",
"CardId": "card_m_NioQspdYckEoRlzd",
"CardType": "CB_VISA_MASTERCARD",
"CardRegistrationURL": "https://pci.sandbox.mangopay.com/api/mangopay/vault/tokenize/eyJjbGllbnQiOiJhbnRob255aF90ZXN0MSIsInRva2VuIjoiUlBQTVdJR1hrd0ZJSGFacyJ9",
"ResultCode": "000000",
"ResultMessage": "Success",
"Currency": "EUR",
"Status": "VALIDATED"
}
Card registrations
Update a Card Registration
PUT
/
v2.01
/
{ClientId}
/
cardregistrations
/
{CardRegistrationId}
curl -X PUT https://api.sandbox.mangopay.com/v2.01/{ClientId}/cardregistrations/{CardRegistrationId} \
-H 'Content-Type: application/json' \
-d '{
"RegistrationData": "data=acIcnwwLleiAvlZUea5VxZlDBkf07H6B9-N7SrRv5Vv7oSLc1hhCdoFX4JxfZL2iUkLIQL3o9ehAOeaXCbc1KFWnr4ySDvkZ--mJxxdF-vw-gzLNe3lvG2loJvmwrDyRNx0xgKTVnyDj15oG8jR88g",
"CardHolderName": "Alex Smith"
}'
{
"RegistrationData": "data=acIcnwwLleiAvlZUea5VxZlDBkf07H6B9-N7SrRv5Vv7oSLc1hhCdoFX4JxfZL2iUkLIQL3o9ehAOeaXCbc1KFWnr4ySDvkZ--mJxxdF-vw-gzLNe3lvG2loJvmwrDyRNx0xgKTVnyDj15oG8jR88g",
"CardHolderName": "Alex 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 {
$cardRegistration = new \MangoPay\CardRegistration();
$cardRegistration->Id = '198660792';
$cardRegistration->RegistrationData = 'data=EwQibNkLWbGepaBektTHQcnk7KxDDpQybRm3BWmKLu4DKdgmC-JI0b4bK9UW5C3u1L4A4AkhT3LJqC3_FAvbwYQXIPvj1ElxL2OIJfvlS3YXlJyOctdX1PGkkgCkgl3j0ftIYwFxOdfmDQ5GtM_cIg';
$response = $api->CardRegistrations->Update($cardRegistration);
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: 'user_m_01HQK25M6KVHKDV0S36JY9NRKR',
}
let userCardRegistration = {
Id: 'cardreg_m_01HRETW28RKJFC8RB9H625RVBD',
UserId: user.Id,
Currency: 'EUR',
CardType: 'CB_VISA_MASTERCARD',
RegistrationData: 'data=acIcnwwLleiAvlZUea5VxT5mw_fK696E0m-dvIdK-KnTCrftajOU7W3fTvYLnKiF68q7RUkmAEL86Wi8c0oX7wHD6vfA3lowMRD7SvlcCCl6Xl3Esy_DIyBzznraJzm70ftIYwFxOdfmDQ5GtM_cIg',
CardHolderName: 'Alex Smith',
}
const updateCardRegistration = async(cardRegistration) => {
return await mangopay.CardRegistrations.update(cardRegistration)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
updateCardRegistration(userCardRegistration)
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 updateCardRegistration(card_registration_id, params)
begin
response = MangoPay::CardRegistration.update(card_registration_id, params)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed : #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
params = {
"RegistrationData": "data=acIcnwwLleiAvlZUea5VxW4I8X8iCT0M1Z4j5kgkKf4KQzh0G0UQLpozaVZwyqUOQJM3kYVZIDlCIp6vDysQ6F0qIb1486gpwf_EGW9fTllJlstGZZo5YuZ8RWz_814ONx0xgKTVnyDj15oG8jR88g",
"CardHolderName": "ALEX SMITH"
}
updateCardRegistration("cardreg_m_01J2C8JM4YHV1Z57RKRBK97B0Y", params)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.entities.CardRegistration;
public class UpdateCardRegistration {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
CardRegistration cardReg = mangopay.getCardRegistrationApi().get("cardreg_m_01HXY9VZN4J1TERYG1BNPDHENN");
cardReg.setRegistrationData("data=acIcnwwLleiAvlZUea5VxfRSGv9nDzXcMqBpL3byXCz_GKPvDDem-KDL6Tf_yaRZBYWP-ghC9O56GivqHUjmwR4Dq2M_FO0KhF_NWnd-fb5L_0I49NvwmWI1uPP5WuzcNx0xgKTVnyDj15oG8jR88g");
CardRegistration updateCardRegistration = mangopay.getCardRegistrationApi().update(cardReg);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(updateCardRegistration);
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 CardRegistration
user_card_registration = CardRegistration(
id = '213600973',
registration_data = 'data=R7hxMYui4h4rBkaNwbiH1DvQL35Y-goFSYQI384_jNsDngV32O95BVgk3Pg7vqU_mZIFFs4gFl24VlSBXNiuoi4Be_uieN3jEegz77g8ElaToz_b7S91YuROvHH0w6J40ftIYwFxOdfmDQ5GtM_cIg',
card_holder_name = 'Alex Smith'
)
update_card_registration = user_card_registration.save()
pprint(update_card_registration)
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 cardRegistrationId = "cardreg_m_01J2Y3ZTFTZSKB5XWAKCNMPWFC";
var registrationData = "data=qc_ShKapgXF-A2t_OC72Ktbe2pgMGnalwOa7YhCbIDdpW0cgKABxbhU6R6yVTVJKZpvPpkvQy0HS6G3zrpUyXboAD2d1WLU2-FKrT2dHpcH9c8YxZgpdCs4Z6c6u-qDT0ftIYwFxOdfmDQ5GtM_cIg";
var cardRegistration = new CardRegistrationPutDTO
{
RegistrationData = registrationData,
Tag = "Updated using the Mangopay .NET SDK"
};
var updateCardRegistration = await api.CardRegistrations.UpdateAsync(cardRegistration, cardRegistrationId);
string prettyPrint = JsonConvert.SerializeObject(updateCardRegistration, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
{
"Id": "cardreg_wt_11ed4694-d244-4bd1-92fb-dc473c99a9d4",
"Tag": null,
"CreationDate": 1726239226,
"UserId": "user_m_01J7KACBPAV7XAF8AH9BDCJPRS",
"AccessKey": "ehvrHoPE6FpjCCAgmNvg",
"PreregistrationData": "lhOJ6CFiDJPCXViyHjfcayh92nouB3AAaB5yqiLCBT6yjkLPCptmxsUdfffAc6EE4uj9AuSfmwbdfKN3BMechzUU3Gz8ectEx70TDeupudr",
"RegistrationData": "data=acIcnwwLleiAvlZUea5VxYT1eCIn3MER8jyZXr-p8Bzb4Rm8GIA0MQtPs2NL7zPzPO_I7EjQm-m92V909JUL6KT-PmPzJfAQZV_8PIz6wKvjorGNaNd8Mg1rqN6eBpS5Nx0xgKTVnyDj15oG8jR875",
"CardId": "card_m_NioQspdYckEoRlzd",
"CardType": "CB_VISA_MASTERCARD",
"CardRegistrationURL": "https://pci.sandbox.mangopay.com/api/mangopay/vault/tokenize/eyJjbGllbnQiOiJhbnRob255aF90ZXN0MSIsInRva2VuIjoiUlBQTVdJR1hrd0ZJSGFacyJ9",
"ResultCode": "000000",
"ResultMessage": "Success",
"Currency": "EUR",
"Status": "VALIDATED"
}
This call is used to add the string acquired from the tokenization to the Card Registration object in the parameter
RegistrationData, thereby validating the registration.
As a result, the Card object is created and the corresponding CardId returned.
Platforms should also send the cardholder’s name as it appears on the payment card. The CardHolderName parameter is sent on this call but not returned in the response; it is added to the Card object.
Path parameters
string
required
The unique identifier of the Card Registration object.
Body parameters
string
required
The string returned by the tokenization server on the POST Tokenize the card endpoint.
string
Min. length: 2 characters; 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.The
CardHolderName is not returned in the Card Registration object; it is added to the Card object.Responses
200 - Status "VALIDATED"
200 - Status "VALIDATED"
string
The unique identifier of the Card Registration object.
string
Custom data that can be added to this object.
In the case of the Card Registration, this parameter can be used to facilitate the link between the User object and its equivalent on your platform for instance. This value will be inherited by the Card object
In the case of the Card Registration, this parameter can be used to facilitate the link between the User object and its equivalent on your platform for instance. This value will be inherited by the Card object
Tag parameter and will not be editable.Unix timestamp
The date and time at which the object was created.
string
The unique identifier of the user the card belongs to.
string
The secure value to use when tokenizing the card via the dedicated endpoint.
string
The secure value to identify the registration when tokenizing the card via the dedicated endpoint.
string
The string returned by the tokenization server, which must be sent in full as the
RegistrationData on the PUT Update a Card Registration endpoint to create the Card object.string
The unique identifier of the Card object, which is returned after updating the Card Registration object with the
RegistrationData.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
The URL to make the card tokenization call.Caution: This variable URL is specific to each card registration. You must rely on the returned URL in full (host, path, and queries) and not hardcode any part of it.
string
The code indicating the result of the operation. This information is mostly used to handle errors or for filtering purposes.
string
The explanation of the result code.
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:
CREATED, VALIDATED, ERRORThe status of the card registration:CREATED– The card registration has been created, but noRegistrationDatahas been entered yet and theCardIdvalue isnull.VALIDATED– The card registration has been successfully updated with theRegistrationDatafrom the tokenization server.ERROR– The card registration couldn’t be updated with theRegistrationDataand noCardIdwas generated. For more information, refer to theResultCode(105206, 105299) andResultMessage.
200 - Status "ERROR"
200 - Status "ERROR"
string
The unique identifier of the Card Registration object.
string
Custom data that can be added to this object.
In the case of the Card Registration, this parameter can be used to facilitate the link between the User object and its equivalent on your platform for instance. This value will be inherited by the Card object
In the case of the Card Registration, this parameter can be used to facilitate the link between the User object and its equivalent on your platform for instance. This value will be inherited by the Card object
Tag parameter and will not be editable.Unix timestamp
The date and time at which the object was created.
string
The unique identifier of the user the card belongs to.
string
The secure value to use when tokenizing the card via the dedicated endpoint.
string
The secure value to identify the registration when tokenizing the card via the dedicated endpoint.
string
The string returned by the tokenization server, which must be sent in full as the
RegistrationData on the PUT Update a Card Registration endpoint to create the Card object.string
The unique identifier of the Card object, which is returned after updating the Card Registration object with the
RegistrationData.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
The URL to make the card tokenization call.Caution: This variable URL is specific to each card registration. You must rely on the returned URL in full (host, path, and queries) and not hardcode any part of it.
string
The code indicating the result of the operation. This information is mostly used to handle errors or for filtering purposes.
string
The explanation of the result code.
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:
CREATED, VALIDATED, ERRORThe status of the card registration:CREATED– The card registration has been created, but noRegistrationDatahas been entered yet and theCardIdvalue isnull.VALIDATED– The card registration has been successfully updated with theRegistrationDatafrom the tokenization server.ERROR– The card registration couldn’t be updated with theRegistrationDataand noCardIdwas generated. For more information, refer to theResultCode(105206, 105299) andResultMessage.
400 - CardHolderName can't be longer than than 255 characters
400 - CardHolderName can't be longer than than 255 characters
{
"Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
"Type": "param_error",
"Id": "a241d282-377f-4415-ab81-5dc11c63f972",
"Date": 1723543647.0,
"errors": {
"CardHolderName": "The field CardHolderName must be between 2 and 255 characters long."
}
}
{
"Id": "cardreg_wt_11ed4694-d244-4bd1-92fb-dc473c99a9d4",
"Tag": null,
"CreationDate": 1726239226,
"UserId": "user_m_01J7KACBPAV7XAF8AH9BDCJPRS",
"AccessKey": "ehvrHoPE6FpjCCAgmNvg",
"PreregistrationData": "lhOJ6CFiDJPCXViyHjfcayh92nouB3AAaB5yqiLCBT6yjkLPCptmxsUdfffAc6EE4uj9AuSfmwbdfKN3BMechzUU3Gz8ectEx70TDeupudr",
"RegistrationData": "data=acIcnwwLleiAvlZUea5VxYT1eCIn3MER8jyZXr-p8Bzb4Rm8GIA0MQtPs2NL7zPzPO_I7EjQm-m92V909JUL6KT-PmPzJfAQZV_8PIz6wKvjorGNaNd8Mg1rqN6eBpS5Nx0xgKTVnyDj15oG8jR875",
"CardId": "card_m_NioQspdYckEoRlzd",
"CardType": "CB_VISA_MASTERCARD",
"CardRegistrationURL": "https://pci.sandbox.mangopay.com/api/mangopay/vault/tokenize/eyJjbGllbnQiOiJhbnRob255aF90ZXN0MSIsInRva2VuIjoiUlBQTVdJR1hrd0ZJSGFacyJ9",
"ResultCode": "000000",
"ResultMessage": "Success",
"Currency": "EUR",
"Status": "VALIDATED"
}
curl -X PUT https://api.sandbox.mangopay.com/v2.01/{ClientId}/cardregistrations/{CardRegistrationId} \
-H 'Content-Type: application/json' \
-d '{
"RegistrationData": "data=acIcnwwLleiAvlZUea5VxZlDBkf07H6B9-N7SrRv5Vv7oSLc1hhCdoFX4JxfZL2iUkLIQL3o9ehAOeaXCbc1KFWnr4ySDvkZ--mJxxdF-vw-gzLNe3lvG2loJvmwrDyRNx0xgKTVnyDj15oG8jR88g",
"CardHolderName": "Alex Smith"
}'
{
"RegistrationData": "data=acIcnwwLleiAvlZUea5VxZlDBkf07H6B9-N7SrRv5Vv7oSLc1hhCdoFX4JxfZL2iUkLIQL3o9ehAOeaXCbc1KFWnr4ySDvkZ--mJxxdF-vw-gzLNe3lvG2loJvmwrDyRNx0xgKTVnyDj15oG8jR88g",
"CardHolderName": "Alex 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 {
$cardRegistration = new \MangoPay\CardRegistration();
$cardRegistration->Id = '198660792';
$cardRegistration->RegistrationData = 'data=EwQibNkLWbGepaBektTHQcnk7KxDDpQybRm3BWmKLu4DKdgmC-JI0b4bK9UW5C3u1L4A4AkhT3LJqC3_FAvbwYQXIPvj1ElxL2OIJfvlS3YXlJyOctdX1PGkkgCkgl3j0ftIYwFxOdfmDQ5GtM_cIg';
$response = $api->CardRegistrations->Update($cardRegistration);
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: 'user_m_01HQK25M6KVHKDV0S36JY9NRKR',
}
let userCardRegistration = {
Id: 'cardreg_m_01HRETW28RKJFC8RB9H625RVBD',
UserId: user.Id,
Currency: 'EUR',
CardType: 'CB_VISA_MASTERCARD',
RegistrationData: 'data=acIcnwwLleiAvlZUea5VxT5mw_fK696E0m-dvIdK-KnTCrftajOU7W3fTvYLnKiF68q7RUkmAEL86Wi8c0oX7wHD6vfA3lowMRD7SvlcCCl6Xl3Esy_DIyBzznraJzm70ftIYwFxOdfmDQ5GtM_cIg',
CardHolderName: 'Alex Smith',
}
const updateCardRegistration = async(cardRegistration) => {
return await mangopay.CardRegistrations.update(cardRegistration)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
updateCardRegistration(userCardRegistration)
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 updateCardRegistration(card_registration_id, params)
begin
response = MangoPay::CardRegistration.update(card_registration_id, params)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed : #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
params = {
"RegistrationData": "data=acIcnwwLleiAvlZUea5VxW4I8X8iCT0M1Z4j5kgkKf4KQzh0G0UQLpozaVZwyqUOQJM3kYVZIDlCIp6vDysQ6F0qIb1486gpwf_EGW9fTllJlstGZZo5YuZ8RWz_814ONx0xgKTVnyDj15oG8jR88g",
"CardHolderName": "ALEX SMITH"
}
updateCardRegistration("cardreg_m_01J2C8JM4YHV1Z57RKRBK97B0Y", params)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.entities.CardRegistration;
public class UpdateCardRegistration {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
CardRegistration cardReg = mangopay.getCardRegistrationApi().get("cardreg_m_01HXY9VZN4J1TERYG1BNPDHENN");
cardReg.setRegistrationData("data=acIcnwwLleiAvlZUea5VxfRSGv9nDzXcMqBpL3byXCz_GKPvDDem-KDL6Tf_yaRZBYWP-ghC9O56GivqHUjmwR4Dq2M_FO0KhF_NWnd-fb5L_0I49NvwmWI1uPP5WuzcNx0xgKTVnyDj15oG8jR88g");
CardRegistration updateCardRegistration = mangopay.getCardRegistrationApi().update(cardReg);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(updateCardRegistration);
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 CardRegistration
user_card_registration = CardRegistration(
id = '213600973',
registration_data = 'data=R7hxMYui4h4rBkaNwbiH1DvQL35Y-goFSYQI384_jNsDngV32O95BVgk3Pg7vqU_mZIFFs4gFl24VlSBXNiuoi4Be_uieN3jEegz77g8ElaToz_b7S91YuROvHH0w6J40ftIYwFxOdfmDQ5GtM_cIg',
card_holder_name = 'Alex Smith'
)
update_card_registration = user_card_registration.save()
pprint(update_card_registration)
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 cardRegistrationId = "cardreg_m_01J2Y3ZTFTZSKB5XWAKCNMPWFC";
var registrationData = "data=qc_ShKapgXF-A2t_OC72Ktbe2pgMGnalwOa7YhCbIDdpW0cgKABxbhU6R6yVTVJKZpvPpkvQy0HS6G3zrpUyXboAD2d1WLU2-FKrT2dHpcH9c8YxZgpdCs4Z6c6u-qDT0ftIYwFxOdfmDQ5GtM_cIg";
var cardRegistration = new CardRegistrationPutDTO
{
RegistrationData = registrationData,
Tag = "Updated using the Mangopay .NET SDK"
};
var updateCardRegistration = await api.CardRegistrations.UpdateAsync(cardRegistration, cardRegistrationId);
string prettyPrint = JsonConvert.SerializeObject(updateCardRegistration, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
Was this page helpful?