{
"CreditedWalletId": "204089031",
"DebitedFunds": {
"Currency": "EUR",
"Amount": 2000
},
"Fees": {
"Currency": "EUR",
"Amount": 200
},
"PreauthorizationId": "preauth_m_01HYG88W1QWJNNBGJJG0KQGX42"
}
<?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 = 'user_m_01HQK25M6KVHKDV0S36JY9NRKR';
$cardId = 'card_m_01J420XC7KAW655XPP12SC28HS';
$walletId = 'wlt_m_01HQT6422EER2N7FPRXWTSDCSV';
$preauthId = 'preauth_m_01JH3CJ75WGC9FMST9RH7SKBSC';
$preauthPayIn = new \MangoPay\PayIn();
$preauthPayIn->AuthorId = $userId;
$preauthPayIn->CreditedWalletId = $walletId;
$preauthPayIn->DebitedFunds = new Money();
$preauthPayIn->DebitedFunds->Amount = 1000;
$preauthPayIn->DebitedFunds->Currency = 'EUR';
$preauthPayIn->Fees = new Money();
$preauthPayIn->Fees->Amount = 0;
$preauthPayIn->Fees->Currency = 'EUR';
$preauthPayIn->PaymentDetails = new \MangoPay\PayInPaymentDetailsPreAuthorized();
$preauthPayIn->PaymentDetails->PreauthorizationId = $preauthId;
$preauthPayIn->ExecutionDetails = new \MangoPay\PayInExecutionDetailsDirect();
$preauthPayIn->ExecutionDetails->SecureModeReturnURL = 'http://example.com';
$preauthPayIn->ExecutionDetails->Culture = 'FR';
$createPayIn = $api->PayIns->Create($preauthPayIn);
print_r($createPayIn);
} 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 myPreauthorizedPayIn = {
PaymentType: 'PREAUTHORIZED',
ExecutionType: 'DIRECT',
AuthorId: '192822811',
Tag: 'Created with Mangopay Node.js SDK',
CreditedUserId: '192822811',
DebitedFunds: {
Currency: 'EUR',
Amount: 1000,
},
Fees: {
Currency: 'EUR',
Amount: 100,
},
CreditedWalletId: '192822814',
PreauthorizationId: '192823192',
}
const createPreauthorizedPayin = async (payin) => {
return await mangopay.PayIns.create(payin)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
createPreauthorizedPayin(myPreauthorizedPayIn)
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 createPreauthorizedPayIn(payInObject)
begin
response = MangoPay::PayIn::PreAuthorized::Direct.create(payInObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to create preauthorized payin: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myPreauthorizedPayIn = {
AuthorId: '192822811',
Tag: 'Created with Mangopay Ruby SDK',
CreditedUserId: '192822811',
DebitedFunds: {
Currency: 'EUR',
Amount: 900,
},
Fees: {
Currency: 'EUR',
Amount: 100,
},
CreditedWalletId: '192822814',
PreauthorizationId: '195059241'
}
createPreauthorizedPayIn(myPreauthorizedPayIn)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.core.Money;
import com.mangopay.core.enumerations.CurrencyIso;
import com.mangopay.entities.PayIn;
import com.mangopay.entities.subentities.PayInExecutionDetailsDirect;
import com.mangopay.entities.subentities.PayInPaymentDetailsPreAuthorized;
public class CreatePreauthPayIn {
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 preauthId = "preauth_m_01J218VW84JAKDZS516PPTQWFW";
var userId = "user_m_01HT2NFK7Z2BRQNGNHMY30VVTT";
var walletId = "wlt_m_01HWAR863HPA3FAVEXA9J6JSYD";
PayIn payIn = new PayIn();
payIn.setCreditedWalletId(walletId);
payIn.setAuthorId(userId);
payIn.setTag("Created using the Mangopay Java SDK");
payIn.setDebitedFunds(new Money());
payIn.getDebitedFunds().setAmount(100);
payIn.getDebitedFunds().setCurrency(CurrencyIso.EUR);
payIn.setFees(new Money());
payIn.getFees().setAmount(0);
payIn.getFees().setCurrency(CurrencyIso.EUR);
payIn.setPaymentDetails(new PayInPaymentDetailsPreAuthorized());
((PayInPaymentDetailsPreAuthorized) payIn.getPaymentDetails()).setPreauthorizationId(preauthId);
payIn.setExecutionDetails(new PayInExecutionDetailsDirect());
((PayInExecutionDetailsDirect) payIn.getExecutionDetails()).setSecureModeReturnUrl("http://example.com");
PayIn createPayIn = mangopay.getPayInApi().create(payIn);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(createPayIn);
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, PreAuthorizedPayIn
from mangopay.utils import Money
natural_user = NaturalUser.get('213753890')
preauthorization_payin = PreAuthorizedPayIn(
author_id = natural_user.id,
debited_funds = Money(amount=1000, currency='GBP'),
fees = Money(amount=0, currency='GBP'),
credited_wallet_id = '213754077',
preauthorization_id = '213944840',
tag='Created using the Mangopay Python SDK'
)
create_preauthorization_payin = preauthorization_payin.save()
pprint(create_preauthorization_payin)
using MangoPay.SDK;
using MangoPay.SDK.Core.Enumerations;
using MangoPay.SDK.Entities;
using MangoPay.SDK.Entities.POST;
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_01J2TZ261WZNDM0ZDRWGDYA4GN";
var walletId = "wlt_m_01J30991BXBB7VF28PBS82EWD3";
var preauthorizationId = "preauth_m_01J30NHM7E0TQ9W5NRQ964W7WF";
var preauthorizedPayIn = new PayInPreauthorizedDirectPostDTO (
userId,
new Money { Amount = 1000, Currency = CurrencyIso.EUR },
new Money { Amount = 0, Currency = CurrencyIso.EUR },
walletId, preauthorizationId)
{
SecureModeReturnURL = "http://www.mangopay.com/please-ignore"
};
var createPreauthorizedPayIn = await api.PayIns.CreatePreauthorizedDirectAsync(preauthorizedPayIn);
string prettyPrint = JsonConvert.SerializeObject(createPreauthorizedPayIn, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
{
"Id": "wt_8da11453-4231-4628-85c8-f8f8674b4ab8",
"Tag": null,
"CreationDate": 1771580679,
"ResultCode": "000000",
"ResultMessage": "Success",
"AuthorId": "user_m_01KHRMAQT1ZPVBWK2KYM6S0N7M",
"CreditedUserId": "user_m_01KH8RY4CGEYM6B5TA6JGKSYDJ",
"DebitedFunds": {
"Currency": "EUR",
"Amount": 10000
},
"CreditedFunds": {
"Currency": "EUR",
"Amount": 9000
},
"Fees": {
"Currency": "EUR",
"Amount": 1000
},
"Status": "SUCCEEDED",
"ExecutionDate": 1771580680,
"Type": "PAYIN",
"Nature": "REGULAR",
"CreditedWalletId": "wlt_m_01KH8RY6BKXD2ZT7F76XH2TS7Z",
"DebitedWalletId": null,
"PaymentType": "PREAUTHORIZED",
"ExecutionType": "DIRECT",
"PreauthorizationId": "preauth_wt_064022a9-3640-4ed1-a4bd-3488426428fa",
"AuthenticationResult": {
"AuthenticationType": "CHALLENGE"
}
}
{
"Id": "5ca9a5a3-8db0-4184-9322-acf521a4e210",
"Tag": "capture attempt",
"CreationDate": 1669115134,
"ResultCode": "001505",
"ResultMessage": "The PayIn DebitedFunds can't be higher than the PreAuthorization remaining amount",
"AuthorId": "user_m_01HQK25M6KVHKDV0S36JY9NRKR",
"CreditedUserId": "user_m_01HQK25M6KVHKDV0S36JY9NRKR",
"DebitedFunds": {
"Currency": "EUR",
"Amount": 700
},
"CreditedFunds": {
"Currency": "EUR",
"Amount": 700
},
"Fees": {
"Currency": "EUR",
"Amount": 0
},
"Status": "FAILED",
"ExecutionDate": null,
"Type": "PAYIN",
"Nature": "REGULAR",
"CreditedWalletId": "wlt_m_01HT2J9Q2M6GMFW4Z7GYBAFJ4T",
"DebitedWalletId": null,
"PaymentType": "PREAUTHORIZED",
"ExecutionType": "DIRECT",
"PreauthorizationId": "preauth_m_01HYG88W1QWJNNBGJJG0KQGX42",
"AuthenticationResult": {
"AuthenticationType": "CHALLENGE"
}
}
Preauthorizations
Create a Preauthorized PayIn
POST
/
v2.01
/
{ClientId}
/
payins
/
preauthorized
/
direct
{
"CreditedWalletId": "204089031",
"DebitedFunds": {
"Currency": "EUR",
"Amount": 2000
},
"Fees": {
"Currency": "EUR",
"Amount": 200
},
"PreauthorizationId": "preauth_m_01HYG88W1QWJNNBGJJG0KQGX42"
}
<?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 = 'user_m_01HQK25M6KVHKDV0S36JY9NRKR';
$cardId = 'card_m_01J420XC7KAW655XPP12SC28HS';
$walletId = 'wlt_m_01HQT6422EER2N7FPRXWTSDCSV';
$preauthId = 'preauth_m_01JH3CJ75WGC9FMST9RH7SKBSC';
$preauthPayIn = new \MangoPay\PayIn();
$preauthPayIn->AuthorId = $userId;
$preauthPayIn->CreditedWalletId = $walletId;
$preauthPayIn->DebitedFunds = new Money();
$preauthPayIn->DebitedFunds->Amount = 1000;
$preauthPayIn->DebitedFunds->Currency = 'EUR';
$preauthPayIn->Fees = new Money();
$preauthPayIn->Fees->Amount = 0;
$preauthPayIn->Fees->Currency = 'EUR';
$preauthPayIn->PaymentDetails = new \MangoPay\PayInPaymentDetailsPreAuthorized();
$preauthPayIn->PaymentDetails->PreauthorizationId = $preauthId;
$preauthPayIn->ExecutionDetails = new \MangoPay\PayInExecutionDetailsDirect();
$preauthPayIn->ExecutionDetails->SecureModeReturnURL = 'http://example.com';
$preauthPayIn->ExecutionDetails->Culture = 'FR';
$createPayIn = $api->PayIns->Create($preauthPayIn);
print_r($createPayIn);
} 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 myPreauthorizedPayIn = {
PaymentType: 'PREAUTHORIZED',
ExecutionType: 'DIRECT',
AuthorId: '192822811',
Tag: 'Created with Mangopay Node.js SDK',
CreditedUserId: '192822811',
DebitedFunds: {
Currency: 'EUR',
Amount: 1000,
},
Fees: {
Currency: 'EUR',
Amount: 100,
},
CreditedWalletId: '192822814',
PreauthorizationId: '192823192',
}
const createPreauthorizedPayin = async (payin) => {
return await mangopay.PayIns.create(payin)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
createPreauthorizedPayin(myPreauthorizedPayIn)
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 createPreauthorizedPayIn(payInObject)
begin
response = MangoPay::PayIn::PreAuthorized::Direct.create(payInObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to create preauthorized payin: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myPreauthorizedPayIn = {
AuthorId: '192822811',
Tag: 'Created with Mangopay Ruby SDK',
CreditedUserId: '192822811',
DebitedFunds: {
Currency: 'EUR',
Amount: 900,
},
Fees: {
Currency: 'EUR',
Amount: 100,
},
CreditedWalletId: '192822814',
PreauthorizationId: '195059241'
}
createPreauthorizedPayIn(myPreauthorizedPayIn)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.core.Money;
import com.mangopay.core.enumerations.CurrencyIso;
import com.mangopay.entities.PayIn;
import com.mangopay.entities.subentities.PayInExecutionDetailsDirect;
import com.mangopay.entities.subentities.PayInPaymentDetailsPreAuthorized;
public class CreatePreauthPayIn {
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 preauthId = "preauth_m_01J218VW84JAKDZS516PPTQWFW";
var userId = "user_m_01HT2NFK7Z2BRQNGNHMY30VVTT";
var walletId = "wlt_m_01HWAR863HPA3FAVEXA9J6JSYD";
PayIn payIn = new PayIn();
payIn.setCreditedWalletId(walletId);
payIn.setAuthorId(userId);
payIn.setTag("Created using the Mangopay Java SDK");
payIn.setDebitedFunds(new Money());
payIn.getDebitedFunds().setAmount(100);
payIn.getDebitedFunds().setCurrency(CurrencyIso.EUR);
payIn.setFees(new Money());
payIn.getFees().setAmount(0);
payIn.getFees().setCurrency(CurrencyIso.EUR);
payIn.setPaymentDetails(new PayInPaymentDetailsPreAuthorized());
((PayInPaymentDetailsPreAuthorized) payIn.getPaymentDetails()).setPreauthorizationId(preauthId);
payIn.setExecutionDetails(new PayInExecutionDetailsDirect());
((PayInExecutionDetailsDirect) payIn.getExecutionDetails()).setSecureModeReturnUrl("http://example.com");
PayIn createPayIn = mangopay.getPayInApi().create(payIn);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(createPayIn);
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, PreAuthorizedPayIn
from mangopay.utils import Money
natural_user = NaturalUser.get('213753890')
preauthorization_payin = PreAuthorizedPayIn(
author_id = natural_user.id,
debited_funds = Money(amount=1000, currency='GBP'),
fees = Money(amount=0, currency='GBP'),
credited_wallet_id = '213754077',
preauthorization_id = '213944840',
tag='Created using the Mangopay Python SDK'
)
create_preauthorization_payin = preauthorization_payin.save()
pprint(create_preauthorization_payin)
using MangoPay.SDK;
using MangoPay.SDK.Core.Enumerations;
using MangoPay.SDK.Entities;
using MangoPay.SDK.Entities.POST;
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_01J2TZ261WZNDM0ZDRWGDYA4GN";
var walletId = "wlt_m_01J30991BXBB7VF28PBS82EWD3";
var preauthorizationId = "preauth_m_01J30NHM7E0TQ9W5NRQ964W7WF";
var preauthorizedPayIn = new PayInPreauthorizedDirectPostDTO (
userId,
new Money { Amount = 1000, Currency = CurrencyIso.EUR },
new Money { Amount = 0, Currency = CurrencyIso.EUR },
walletId, preauthorizationId)
{
SecureModeReturnURL = "http://www.mangopay.com/please-ignore"
};
var createPreauthorizedPayIn = await api.PayIns.CreatePreauthorizedDirectAsync(preauthorizedPayIn);
string prettyPrint = JsonConvert.SerializeObject(createPreauthorizedPayIn, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
{
"Id": "wt_8da11453-4231-4628-85c8-f8f8674b4ab8",
"Tag": null,
"CreationDate": 1771580679,
"ResultCode": "000000",
"ResultMessage": "Success",
"AuthorId": "user_m_01KHRMAQT1ZPVBWK2KYM6S0N7M",
"CreditedUserId": "user_m_01KH8RY4CGEYM6B5TA6JGKSYDJ",
"DebitedFunds": {
"Currency": "EUR",
"Amount": 10000
},
"CreditedFunds": {
"Currency": "EUR",
"Amount": 9000
},
"Fees": {
"Currency": "EUR",
"Amount": 1000
},
"Status": "SUCCEEDED",
"ExecutionDate": 1771580680,
"Type": "PAYIN",
"Nature": "REGULAR",
"CreditedWalletId": "wlt_m_01KH8RY6BKXD2ZT7F76XH2TS7Z",
"DebitedWalletId": null,
"PaymentType": "PREAUTHORIZED",
"ExecutionType": "DIRECT",
"PreauthorizationId": "preauth_wt_064022a9-3640-4ed1-a4bd-3488426428fa",
"AuthenticationResult": {
"AuthenticationType": "CHALLENGE"
}
}
{
"Id": "5ca9a5a3-8db0-4184-9322-acf521a4e210",
"Tag": "capture attempt",
"CreationDate": 1669115134,
"ResultCode": "001505",
"ResultMessage": "The PayIn DebitedFunds can't be higher than the PreAuthorization remaining amount",
"AuthorId": "user_m_01HQK25M6KVHKDV0S36JY9NRKR",
"CreditedUserId": "user_m_01HQK25M6KVHKDV0S36JY9NRKR",
"DebitedFunds": {
"Currency": "EUR",
"Amount": 700
},
"CreditedFunds": {
"Currency": "EUR",
"Amount": 700
},
"Fees": {
"Currency": "EUR",
"Amount": 0
},
"Status": "FAILED",
"ExecutionDate": null,
"Type": "PAYIN",
"Nature": "REGULAR",
"CreditedWalletId": "wlt_m_01HT2J9Q2M6GMFW4Z7GYBAFJ4T",
"DebitedWalletId": null,
"PaymentType": "PREAUTHORIZED",
"ExecutionType": "DIRECT",
"PreauthorizationId": "preauth_m_01HYG88W1QWJNNBGJJG0KQGX42",
"AuthenticationResult": {
"AuthenticationType": "CHALLENGE"
}
}
Body parameters
string
Max. length: 255 charactersCustom data that you can add to this object.
For transactions (pay-in, transfer, payout), you can use this parameter to identify corresponding information regarding the user, transaction, or payment methods on your platform.
For transactions (pay-in, transfer, payout), you can use this parameter to identify corresponding information regarding the user, transaction, or payment methods on your platform.
string
The unique identifier of the user at the source of the transaction.
string
Default value: The unique identifier of the owner of the credited wallet.The unique identifier of the user whose wallet is credited.
object
required
Information about the debited funds.
Show properties
Show properties
string
required
Allowed 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 debited funds.
integer
required
An amount of money in the smallest sub-division of the currency (e.g., EUR 12.60 would be represented as
1260 whereas JPY 12 would be represented as just 12).object
required
Information about the fees taken by the platform for this transaction (and hence transferred to the Fees Wallet).
Show properties
Show properties
string
required
Allowed 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 fees.
integer
required
An amount of money in the smallest sub-division of the currency (e.g., EUR 12.60 would be represented as
1260 whereas JPY 12 would be represented as just 12).string
required
The unique identifier of the credited wallet.
string
required
The unique identifier of the preauthorization.
Responses
200 - Successful capture
200 - Successful capture
string
Max length: 128 characters (see data formats for details)The unique identifier of the object.
string
Max. length: 255 charactersCustom data that you can add to this object.
Unix timestamp
The date and time at which the object was created.
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
The unique identifier of the user at the source of the transaction.
string
Default value: The unique identifier of the owner of the credited wallet.The unique identifier of the user whose wallet is credited.
object
Information about the debited funds.
Show properties
Show properties
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 debited funds.
integer
An amount of money in the smallest sub-division of the currency (e.g., EUR 12.60 would be represented as
1260 whereas JPY 12 would be represented as just 12).object
Information about the credited funds (
CreditedFunds = DebitedFunds - Fees).Show properties
Show properties
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 credited funds.
integer
An amount of money in the smallest sub-division of the currency (e.g., EUR 12.60 would be represented as
1260 whereas JPY 12 would be represented as just 12).object
Information about the fees taken by the platform for this transaction (and hence transferred to the Fees Wallet).
Show properties
Show properties
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 fees.
integer
An amount of money in the smallest sub-division of the currency (e.g., EUR 12.60 would be represented as
1260 whereas JPY 12 would be represented as just 12).string
Returned values:
CREATED, SUCCEEDED, FAILEDThe status of the transaction.Unix timestamp
The date and time at which the status changed to
SUCCEEDED, indicating that the transaction occurred. The statuses CREATED and FAILED return an ExecutionDate of null.string
Returned values:
PAYIN, TRANSFER, CONVERSION, PAYOUTThe type of the transaction.string
Returned values:
REGULAR, REPUDIATION, REFUND, SETTLEMENTThe nature of the transaction, providing more information about the context in which the transaction occurred:REGULAR– Relative to most of the transactions (pay-ins, payouts, and transfers) in a usual workflow.REPUDIATION– Automatic withdrawal of funds from the platform’s repudiation wallet as part of the dispute process (when the user has requested a chargeback).REFUND– Reimbursement of a transaction to the user (pay-in refund), to a wallet (transfer refund), or of a payout (payout refund, only initiated by Mangopay).SETTLEMENT– Transfer made to the repudiation wallet by the platform to settle a lost dispute.
string
The unique identifier of the credited wallet.
string
The unique identifier of the debited wallet.In the case of a pay-in, this value is always
null since there is no debited wallet.string
Returned values:
CARD, DIRECT_DEBIT, PREAUTHORIZED, BANK_WIREThe type of pay-in.string
Returned values:
WEB, DIRECT, EXTERNAL_INSTRUCTIONThe type of execution for the pay-in.string
The unique identifier of the preauthorization.
object | null
Information about the authentication result, based on the request made by Mangopay and the decision of the issuer regarding the type of authentication to be enforced (if applicable).
Show properties
Show properties
string | null
Response values:
CHALLENGE, FRICTIONLESS, DIRECT_AUTHORIZATIONThe type of authentication:CHALLENGE– The issuer requested SCA to be enforced (for example, using 3DS).FRICTIONLESS– The transaction was exempted from SCA because an exemption was granted by the issuer.DIRECT_AUTHORIZATION– The transaction was sent to the issuer for authorization without any frictionless or challenge (for example, if SCA doesn’t apply).
null value typically indicates that authentication was not requested (for example, because the request failed before being sent) or a decision was not received.400 - Failed: Preauthorization Status must be SUCCEEDED
400 - Failed: Preauthorization Status must be SUCCEEDED
{
"Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
"Type": "param_error",
"Id": "b6a5ae0d-7dc9-479a-86bd-55b0d40dccec#1669116785",
"Date": 1669116786,
"errors": {
"Status": "The PreAuthorization Status value has to be up to SUCCEEDED"
}
}
400 - Failed: Preauthorization PaymentStatus must be WAITING
400 - Failed: Preauthorization PaymentStatus must be WAITING
{
"Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
"Type": "param_error",
"Id": "2a6b5503-551b-4a66-a7f4-3ae4d6efc91f",
"Date": 1716385561.0,
"errors": {
"PaymentStatus": "The PreAuthorization PaymentStatus value has to be WAITING"
}
}
{
"Id": "wt_8da11453-4231-4628-85c8-f8f8674b4ab8",
"Tag": null,
"CreationDate": 1771580679,
"ResultCode": "000000",
"ResultMessage": "Success",
"AuthorId": "user_m_01KHRMAQT1ZPVBWK2KYM6S0N7M",
"CreditedUserId": "user_m_01KH8RY4CGEYM6B5TA6JGKSYDJ",
"DebitedFunds": {
"Currency": "EUR",
"Amount": 10000
},
"CreditedFunds": {
"Currency": "EUR",
"Amount": 9000
},
"Fees": {
"Currency": "EUR",
"Amount": 1000
},
"Status": "SUCCEEDED",
"ExecutionDate": 1771580680,
"Type": "PAYIN",
"Nature": "REGULAR",
"CreditedWalletId": "wlt_m_01KH8RY6BKXD2ZT7F76XH2TS7Z",
"DebitedWalletId": null,
"PaymentType": "PREAUTHORIZED",
"ExecutionType": "DIRECT",
"PreauthorizationId": "preauth_wt_064022a9-3640-4ed1-a4bd-3488426428fa",
"AuthenticationResult": {
"AuthenticationType": "CHALLENGE"
}
}
{
"Id": "5ca9a5a3-8db0-4184-9322-acf521a4e210",
"Tag": "capture attempt",
"CreationDate": 1669115134,
"ResultCode": "001505",
"ResultMessage": "The PayIn DebitedFunds can't be higher than the PreAuthorization remaining amount",
"AuthorId": "user_m_01HQK25M6KVHKDV0S36JY9NRKR",
"CreditedUserId": "user_m_01HQK25M6KVHKDV0S36JY9NRKR",
"DebitedFunds": {
"Currency": "EUR",
"Amount": 700
},
"CreditedFunds": {
"Currency": "EUR",
"Amount": 700
},
"Fees": {
"Currency": "EUR",
"Amount": 0
},
"Status": "FAILED",
"ExecutionDate": null,
"Type": "PAYIN",
"Nature": "REGULAR",
"CreditedWalletId": "wlt_m_01HT2J9Q2M6GMFW4Z7GYBAFJ4T",
"DebitedWalletId": null,
"PaymentType": "PREAUTHORIZED",
"ExecutionType": "DIRECT",
"PreauthorizationId": "preauth_m_01HYG88W1QWJNNBGJJG0KQGX42",
"AuthenticationResult": {
"AuthenticationType": "CHALLENGE"
}
}
{
"CreditedWalletId": "204089031",
"DebitedFunds": {
"Currency": "EUR",
"Amount": 2000
},
"Fees": {
"Currency": "EUR",
"Amount": 200
},
"PreauthorizationId": "preauth_m_01HYG88W1QWJNNBGJJG0KQGX42"
}
<?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 = 'user_m_01HQK25M6KVHKDV0S36JY9NRKR';
$cardId = 'card_m_01J420XC7KAW655XPP12SC28HS';
$walletId = 'wlt_m_01HQT6422EER2N7FPRXWTSDCSV';
$preauthId = 'preauth_m_01JH3CJ75WGC9FMST9RH7SKBSC';
$preauthPayIn = new \MangoPay\PayIn();
$preauthPayIn->AuthorId = $userId;
$preauthPayIn->CreditedWalletId = $walletId;
$preauthPayIn->DebitedFunds = new Money();
$preauthPayIn->DebitedFunds->Amount = 1000;
$preauthPayIn->DebitedFunds->Currency = 'EUR';
$preauthPayIn->Fees = new Money();
$preauthPayIn->Fees->Amount = 0;
$preauthPayIn->Fees->Currency = 'EUR';
$preauthPayIn->PaymentDetails = new \MangoPay\PayInPaymentDetailsPreAuthorized();
$preauthPayIn->PaymentDetails->PreauthorizationId = $preauthId;
$preauthPayIn->ExecutionDetails = new \MangoPay\PayInExecutionDetailsDirect();
$preauthPayIn->ExecutionDetails->SecureModeReturnURL = 'http://example.com';
$preauthPayIn->ExecutionDetails->Culture = 'FR';
$createPayIn = $api->PayIns->Create($preauthPayIn);
print_r($createPayIn);
} 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 myPreauthorizedPayIn = {
PaymentType: 'PREAUTHORIZED',
ExecutionType: 'DIRECT',
AuthorId: '192822811',
Tag: 'Created with Mangopay Node.js SDK',
CreditedUserId: '192822811',
DebitedFunds: {
Currency: 'EUR',
Amount: 1000,
},
Fees: {
Currency: 'EUR',
Amount: 100,
},
CreditedWalletId: '192822814',
PreauthorizationId: '192823192',
}
const createPreauthorizedPayin = async (payin) => {
return await mangopay.PayIns.create(payin)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
createPreauthorizedPayin(myPreauthorizedPayIn)
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 createPreauthorizedPayIn(payInObject)
begin
response = MangoPay::PayIn::PreAuthorized::Direct.create(payInObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to create preauthorized payin: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myPreauthorizedPayIn = {
AuthorId: '192822811',
Tag: 'Created with Mangopay Ruby SDK',
CreditedUserId: '192822811',
DebitedFunds: {
Currency: 'EUR',
Amount: 900,
},
Fees: {
Currency: 'EUR',
Amount: 100,
},
CreditedWalletId: '192822814',
PreauthorizationId: '195059241'
}
createPreauthorizedPayIn(myPreauthorizedPayIn)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.core.Money;
import com.mangopay.core.enumerations.CurrencyIso;
import com.mangopay.entities.PayIn;
import com.mangopay.entities.subentities.PayInExecutionDetailsDirect;
import com.mangopay.entities.subentities.PayInPaymentDetailsPreAuthorized;
public class CreatePreauthPayIn {
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 preauthId = "preauth_m_01J218VW84JAKDZS516PPTQWFW";
var userId = "user_m_01HT2NFK7Z2BRQNGNHMY30VVTT";
var walletId = "wlt_m_01HWAR863HPA3FAVEXA9J6JSYD";
PayIn payIn = new PayIn();
payIn.setCreditedWalletId(walletId);
payIn.setAuthorId(userId);
payIn.setTag("Created using the Mangopay Java SDK");
payIn.setDebitedFunds(new Money());
payIn.getDebitedFunds().setAmount(100);
payIn.getDebitedFunds().setCurrency(CurrencyIso.EUR);
payIn.setFees(new Money());
payIn.getFees().setAmount(0);
payIn.getFees().setCurrency(CurrencyIso.EUR);
payIn.setPaymentDetails(new PayInPaymentDetailsPreAuthorized());
((PayInPaymentDetailsPreAuthorized) payIn.getPaymentDetails()).setPreauthorizationId(preauthId);
payIn.setExecutionDetails(new PayInExecutionDetailsDirect());
((PayInExecutionDetailsDirect) payIn.getExecutionDetails()).setSecureModeReturnUrl("http://example.com");
PayIn createPayIn = mangopay.getPayInApi().create(payIn);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(createPayIn);
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, PreAuthorizedPayIn
from mangopay.utils import Money
natural_user = NaturalUser.get('213753890')
preauthorization_payin = PreAuthorizedPayIn(
author_id = natural_user.id,
debited_funds = Money(amount=1000, currency='GBP'),
fees = Money(amount=0, currency='GBP'),
credited_wallet_id = '213754077',
preauthorization_id = '213944840',
tag='Created using the Mangopay Python SDK'
)
create_preauthorization_payin = preauthorization_payin.save()
pprint(create_preauthorization_payin)
using MangoPay.SDK;
using MangoPay.SDK.Core.Enumerations;
using MangoPay.SDK.Entities;
using MangoPay.SDK.Entities.POST;
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_01J2TZ261WZNDM0ZDRWGDYA4GN";
var walletId = "wlt_m_01J30991BXBB7VF28PBS82EWD3";
var preauthorizationId = "preauth_m_01J30NHM7E0TQ9W5NRQ964W7WF";
var preauthorizedPayIn = new PayInPreauthorizedDirectPostDTO (
userId,
new Money { Amount = 1000, Currency = CurrencyIso.EUR },
new Money { Amount = 0, Currency = CurrencyIso.EUR },
walletId, preauthorizationId)
{
SecureModeReturnURL = "http://www.mangopay.com/please-ignore"
};
var createPreauthorizedPayIn = await api.PayIns.CreatePreauthorizedDirectAsync(preauthorizedPayIn);
string prettyPrint = JsonConvert.SerializeObject(createPreauthorizedPayIn, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
Was this page helpful?
⌘I