{
"AuthorId": "user_m_01KGHXXFF6AQZA68MESVQVY7RA",
"CreditedWalletId": "wlt_m_01KGSJ7GQY0P12EBB6XFAC866C",
"DebitedWalletId": "wlt_m_01KGSJDM69VNXPKKGH1B3QFVFC",
"DebitedFunds": {
"Currency": "GBP",
"Amount": 1000
},
"CreditedFunds": {
"Currency": "EUR"
},
"Fees": {
"Type": "PERCENTAGE",
"Value": 700,
"Currency": "GBP"
},
"UserMargin": {
"Type": "PERCENTAGE",
"Value": 1.5,
"Currency": "GBP"
},
"Tag": "Created using the Mangopay API Postman collection"
}
<?php
require_once '../vendor/autoload.php';
use MangoPay\MangoPayApi;
use MangoPay\Libraries\ResponseException as MGPResponseException;
use MangoPay\Libraries\Exception as MGPException;
use MangoPay\Money;
$api = new MangoPayApi();
$api->Config->ClientId = 'client-id';
$api->Config->ClientPassword = 'api-key';
$api->Config->TemporaryFolder = '../tmp/';
$api->Config->DebugMode = false;
try {
$instantConversion = new \MangoPay\Conversion();
$debitedUserId = "user_m_01HQK25M6KVHKDV0S36JY9NRKR";
$debitedWalletId = "wlt_m_01HQT7AS0FJPGYXDXJ0R151NBV";
$creditedWalletId = "wlt_m_01HQT6422EER2N7FPRXWTSDCSV";
$instantConversion->AuthorId = $debitedUserId;
$instantConversion->DebitedWalletId = $debitedWalletId;
$instantConversion->CreditedWalletId = $creditedWalletId;
$instantConversion->DebitedFunds = new Money();
$instantConversion->DebitedFunds->Amount = 100;
$instantConversion->DebitedFunds->Currency = "GBP";
$instantConversion->CreditedFunds = new Money();
$instantConversion->CreditedFunds->Currency = "EUR";
$instantConversion->Tag = "Created using the Mangopay PHP SDK";
$response = $api->Conversions->CreateInstantConversion($instantConversion);
print_r($response);
} catch(MGPResponseException $e) {
print_r($e);
} catch(MGPException $e) {
print_r($e);
}
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.Conversion;
import com.mangopay.entities.CreateInstantConversion;
public class CreatingInstantConversion {
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 debitedUserId = "user_m_01HQK25M6KVHKDV0S36JY9NRKR";
var debitedWalletId = "wlt_m_01HQT7AS0FJPGYXDXJ0R151NBV";
var creditedWalletId = "wlt_m_01HQT6422EER2N7FPRXWTSDCSV";
CreateInstantConversion instantConversion = new CreateInstantConversion();
instantConversion.setAuthorId(debitedUserId);
instantConversion.setCreditedWalletId(creditedWalletId);
instantConversion.setDebitedWalletId(debitedWalletId);
Money debitedFunds = new Money();
debitedFunds.setCurrency(CurrencyIso.GBP);
debitedFunds.setAmount(100);
Money creditedFunds = new Money();
creditedFunds.setCurrency(CurrencyIso.EUR);
Money fees = new Money();
fees.setCurrency(CurrencyIso.GBP);
fees.setAmount(10);
instantConversion.setCreditedFunds(creditedFunds);
instantConversion.setDebitedFunds(debitedFunds);
instantConversion.setFees(fees);
instantConversion.setTag("Created using the Mangopay Java SDK");
Conversion createInstantConversion = mangopay.getConversionsApi().createInstantConversion(instantConversion, null);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(createInstantConversion);
System.out.println(prettyJson);
}
}
{
"Id": "cvr_01KH3K4ZER63X4KT634TJZHWE1",
"Type": "CONVERSION",
"Nature": "REGULAR",
"CreationDate": 1770721017,
"Status": "SUCCEEDED",
"AuthorId": "user_m_01KGHXXFF6AQZA68MESVQVY7RA",
"DebitedWalletId": "wlt_m_01KGSJDM69VNXPKKGH1B3QFVFC",
"CreditedWalletId": "wlt_m_01KGSJ7GQY0P12EBB6XFAC866C",
"DebitedFunds": {
"Currency": "GBP",
"Amount": 1000
},
"CreditedFunds": {
"Currency": "EUR",
"Amount": 1067
},
"Fees": {
"Currency": "GBP",
"Amount": 70
},
"RequestedFees": {
"Type": "PERCENTAGE",
"Value": 700,
"Currency": "GBP"
},
"ResultCode": "000000",
"ResultMessage": "Success",
"ExecutionDate": 1770721018,
"ConversionRateResponse": {
"ClientRate": 1.13798,
"MarketRate": 1.1471573,
"FinalRate": 1.1209103
},
"MarginsResponse": {
"Mangopay": {
"Type": "PERCENTAGE",
"Value": 0.8,
"Amount": 8
},
"User": {
"Type": "PERCENTAGE",
"Value": 1.5,
"Amount": 16
}
},
"Tag": "Created using the Mangopay API Postman collection"
}
Conversions
Create an Instant Conversion between user Wallets
POST
/
v2.01
/
{ClientId}
/
conversions
/
instant-conversion
{
"AuthorId": "user_m_01KGHXXFF6AQZA68MESVQVY7RA",
"CreditedWalletId": "wlt_m_01KGSJ7GQY0P12EBB6XFAC866C",
"DebitedWalletId": "wlt_m_01KGSJDM69VNXPKKGH1B3QFVFC",
"DebitedFunds": {
"Currency": "GBP",
"Amount": 1000
},
"CreditedFunds": {
"Currency": "EUR"
},
"Fees": {
"Type": "PERCENTAGE",
"Value": 700,
"Currency": "GBP"
},
"UserMargin": {
"Type": "PERCENTAGE",
"Value": 1.5,
"Currency": "GBP"
},
"Tag": "Created using the Mangopay API Postman collection"
}
<?php
require_once '../vendor/autoload.php';
use MangoPay\MangoPayApi;
use MangoPay\Libraries\ResponseException as MGPResponseException;
use MangoPay\Libraries\Exception as MGPException;
use MangoPay\Money;
$api = new MangoPayApi();
$api->Config->ClientId = 'client-id';
$api->Config->ClientPassword = 'api-key';
$api->Config->TemporaryFolder = '../tmp/';
$api->Config->DebugMode = false;
try {
$instantConversion = new \MangoPay\Conversion();
$debitedUserId = "user_m_01HQK25M6KVHKDV0S36JY9NRKR";
$debitedWalletId = "wlt_m_01HQT7AS0FJPGYXDXJ0R151NBV";
$creditedWalletId = "wlt_m_01HQT6422EER2N7FPRXWTSDCSV";
$instantConversion->AuthorId = $debitedUserId;
$instantConversion->DebitedWalletId = $debitedWalletId;
$instantConversion->CreditedWalletId = $creditedWalletId;
$instantConversion->DebitedFunds = new Money();
$instantConversion->DebitedFunds->Amount = 100;
$instantConversion->DebitedFunds->Currency = "GBP";
$instantConversion->CreditedFunds = new Money();
$instantConversion->CreditedFunds->Currency = "EUR";
$instantConversion->Tag = "Created using the Mangopay PHP SDK";
$response = $api->Conversions->CreateInstantConversion($instantConversion);
print_r($response);
} catch(MGPResponseException $e) {
print_r($e);
} catch(MGPException $e) {
print_r($e);
}
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.Conversion;
import com.mangopay.entities.CreateInstantConversion;
public class CreatingInstantConversion {
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 debitedUserId = "user_m_01HQK25M6KVHKDV0S36JY9NRKR";
var debitedWalletId = "wlt_m_01HQT7AS0FJPGYXDXJ0R151NBV";
var creditedWalletId = "wlt_m_01HQT6422EER2N7FPRXWTSDCSV";
CreateInstantConversion instantConversion = new CreateInstantConversion();
instantConversion.setAuthorId(debitedUserId);
instantConversion.setCreditedWalletId(creditedWalletId);
instantConversion.setDebitedWalletId(debitedWalletId);
Money debitedFunds = new Money();
debitedFunds.setCurrency(CurrencyIso.GBP);
debitedFunds.setAmount(100);
Money creditedFunds = new Money();
creditedFunds.setCurrency(CurrencyIso.EUR);
Money fees = new Money();
fees.setCurrency(CurrencyIso.GBP);
fees.setAmount(10);
instantConversion.setCreditedFunds(creditedFunds);
instantConversion.setDebitedFunds(debitedFunds);
instantConversion.setFees(fees);
instantConversion.setTag("Created using the Mangopay Java SDK");
Conversion createInstantConversion = mangopay.getConversionsApi().createInstantConversion(instantConversion, null);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(createInstantConversion);
System.out.println(prettyJson);
}
}
{
"Id": "cvr_01KH3K4ZER63X4KT634TJZHWE1",
"Type": "CONVERSION",
"Nature": "REGULAR",
"CreationDate": 1770721017,
"Status": "SUCCEEDED",
"AuthorId": "user_m_01KGHXXFF6AQZA68MESVQVY7RA",
"DebitedWalletId": "wlt_m_01KGSJDM69VNXPKKGH1B3QFVFC",
"CreditedWalletId": "wlt_m_01KGSJ7GQY0P12EBB6XFAC866C",
"DebitedFunds": {
"Currency": "GBP",
"Amount": 1000
},
"CreditedFunds": {
"Currency": "EUR",
"Amount": 1067
},
"Fees": {
"Currency": "GBP",
"Amount": 70
},
"RequestedFees": {
"Type": "PERCENTAGE",
"Value": 700,
"Currency": "GBP"
},
"ResultCode": "000000",
"ResultMessage": "Success",
"ExecutionDate": 1770721018,
"ConversionRateResponse": {
"ClientRate": 1.13798,
"MarketRate": 1.1471573,
"FinalRate": 1.1209103
},
"MarginsResponse": {
"Mangopay": {
"Type": "PERCENTAGE",
"Value": 0.8,
"Amount": 8
},
"User": {
"Type": "PERCENTAGE",
"Value": 1.5,
"Amount": 16
}
},
"Tag": "Created using the Mangopay API Postman collection"
}
This call triggers an immediate conversion at the market rate, of the debited funds to the credited wallet at the market rate. A quote is not required for an instant conversion.
Functional errors (
Body parameters
string
required
The unique identifier of the user at the source of the transaction. In a conversion, both the debited and credited wallets are owned by the author.
string
required
The unique identifier of the debited wallet (in the sell currency).
string
required
The unique identifier of the credited wallet (in the buy currency).
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 (the sell currency).
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).During a conversion, (DebitedFunds.Amount - Fees) * MarketRate = CreditedFunds.Amount. object
required
Information about the credited 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 credited funds (the buy currency).
object
Information about the fees taken by the platform for this transaction (and hence transferred to the Fees Wallet).
Show properties
Show properties
string | null
Allowed values:
PERCENTAGE, FIXEDDefault value: FIXEDThe type of the Value.integer
required
The value to be used for the
Type:PERCENTAGE– In quantities of 0.1% (e.g.150equals 1.5%), the percentage ofDebitedFunds.Amountdeducted as fees.FIXED– The amount deducted fromDebitedFunds.Amountas fees, as an amount of money in the smallest sub-division of the currency (e.g., EUR 12.60 would be represented as1260whereas JPY 12 would be represented as just12).
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, which must match the debited currency.
integer
deprecated
For backwards compatibility, the
Amount is accepted if sent instead of the Value.object
Information about an indicative margin your platform can calculate and charge to the user after conversion. These values are used to calculate the
ConversionRateResponse.FinalRate and the MarginsResponse.User in the API response.Show properties
Show properties
string
required
Allowed values:
PERCENTAGE, PIPThe type of the Value.float
required
The value of the
Type:- PERCENTAGE
- PIP
Max. value:
10.0 (10%); max. 16 decimal placesThe quantities of 1% used to calculate the user margin.Max value:
1000.0The quantities of 0.0001 (one pip) used to calculate the user margin.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, which must match the debited currency.
string
Max. length: 255 charactersCustom data that you can add to this object.
Responses
200 - Succeeded
200 - Succeeded
string
Max length: 128 characters (see data formats for details)The unique identifier of the object.
string
The type of 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.
Unix timestamp
The date and time at which the object was created.
string
Returned values:
CREATED, SUCCEEDED, FAILEDThe status of the transaction.string
The unique identifier of the user at the source of the transaction. In a conversion, both the debited and credited wallets are owned by the author.
string
The unique identifier of the debited wallet (in the sell currency).
string
The unique identifier of the credited wallet (in the buy currency).
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 (the sell currency).
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).During a conversion, (DebitedFunds.Amount - Fees) * MarketRate = CreditedFunds.Amount. object
Information about the credited 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 credited funds (the buy currency).
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).During a conversion, CreditedFunds.Amount = (DebitedFunds.Amount - Fees) * MarketRate. object
Information about the fees taken by the platform for this transaction (and hence transferred to the Fees Wallet).Note: The fees currency must match the debited funds currency.
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).object
Information about the
Fees sent in the request.Show properties
Show properties
string
Allowed values:
PERCENTAGE, FIXEDDefault value: FIXEDThe type of the Value.integer
The value to be used for the
Type:PERCENTAGE– In quantities of 0.1% (e.g.150equals 1.5%), the percentage ofDebitedFunds.Amountdeducted as fees.FIXED– The amount deducted fromDebitedFunds.Amountas fees, as an amount of money in the smallest sub-division of the currency (e.g., EUR 12.60 would be represented as1260whereas JPY 12 would be represented as just12).
string
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, which must match the debited currency.
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.
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.object
Information about the
MarketRate used to convert funds and other indicative rates.Show properties
Show properties
float
Max. 7 decimal placesThe indicative rate including Mangopay’s markup, used during the billing cycle:
ClientRate = MarketRate * (1 - MarginsResponse.Mangopay). The MarginsResponse.Mangopay.Amount gives the amount of debited currency that will be billed by Mangopay to your platform for the transaction.The ClientRate fluctuates in line with the MarketRate.float
Max. 7 decimal placesThe rate used to convert funds during the conversion: (
DebitedFunds.Amount - Fees) * MarketRate = CreditedFunds.Amount.The market rate fluctuates in line with FX market dynamics and is common to all platforms for the currency pair.float
Max. 7 decimal placesThe indicative rate including the
UserMargin, if your platform defined it in the request or the quote: FinalRate = ClientRate * (1 - MarginsResponse.User). The MarginsResponse.User.Amount gives the amount of debited currency that your platform could bill to the user for the transaction.If no UserMargin was included, the FinalRate is the same as the ClientRate.object
Information about the margins calculated for the transaction.
Show properties
Show properties
object
The margin used by Mangopay to bill your platform (which is defined during contracting).
Show properties
Show properties
string
Response value:
PERCENTAGEThe type of the Value, which for Mangopay is always PERCENTAGE.float
The value to be used for the
Type.Mangopay’s markup is expressed as a percentage (to convert to decimal, divide by 100).integer
The amount of debited currency that Mangopay will charge your platform for the transaction during the billing cycle.
object | null
The margin your platform could use to bill the user, as calculated by
UserMargin in the request or quote (otherwise null if not set).Show properties
Show properties
string
Response values:
PERCENTAGE, PIPThe type of the Value.float
The value to be used for the
Type:PERCENTAGE- The quantities of 1% used to calculate the user margin.PIP- The quantities of0.0001(one pip) used to calculate the user margin.
integer
The amount of debited currency that your platform could bill to the user for the transaction.
string
Max. length: 255 charactersCustom data that you can add to this object.
ResultCode) are possible on a 200 response. Read more →
400 - Author not debited wallet owner
400 - Author not debited wallet owner
{
"Message": "Author 45671234 is not debited wallet 204089031 owner.",
"Type": "author_is_not_debited_wallet_owner",
"Id": "5251717e-0965-4e33-a85a-a1042775913f",
"Date": 1699532783,
"errors": null
}
400 - Author not credited wallet owner
400 - Author not credited wallet owner
{
"Message": "Author 204068024 is not credited wallet 208282959 owner.",
"Type": "author_is_not_credited_wallet_owner",
"Id": "f072dcfd-d02c-4489-835f-7abe0b11fa66",
"Date": 1699532982,
"errors": null
}
400 - Debited funds currency doesn’t match debited wallet currency
400 - Debited funds currency doesn’t match debited wallet currency
{
"Message": "Debited currency incompatibility.",
"Type": "currency_incompatibility",
"Id": "af071186-b891-4e0d-baeb-736c15a757e8",
"Date": 1699532861,
"errors": null
}
400 - Credited funds currency doesn’t match credited wallet currency
400 - Credited funds currency doesn’t match credited wallet currency
{
"Message": "Credited currency incompatibility.",
"Type": "currency_incompatibility",
"Id": "2466e688-5f4f-4dfa-8ebe-97b5608c3dd5",
"Date": 1699532915,
"errors": null
}
400 - Fees currency doesn't match debited funds currency
400 - Fees currency doesn't match debited funds currency
{
"Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
"Type": "param_error",
"Id": "f19eafbd-0310-4814-8f6b-691910b7b4a2",
"Date": 1707323047,
"errors": {
"Fees.Currency": "Provided currency USD does not match debit currency of GBP"
}
}
403 - Currency not activated
403 - Currency not activated
{
"Message": "The currency JPY is not enabled for Forex. Contact your support to activate this feature.",
"Type": "forex_not_available",
"Id": "f8701d45-2540-4497-a7ce-4a3bc3181d68",
"Date": 1699533051,
"errors": null
}
403 - FX feature not activated
403 - FX feature not activated
{
"Message": "Forex module is not enabled. Contact your support to activate this feature.",
"Type": "forbidden_ressource",
"Id": "812b8909-9fb1-45b5-9000-06e8c8d73687",
"Date": 1699533020,
"errors": null
}
{
"Id": "cvr_01KH3K4ZER63X4KT634TJZHWE1",
"Type": "CONVERSION",
"Nature": "REGULAR",
"CreationDate": 1770721017,
"Status": "SUCCEEDED",
"AuthorId": "user_m_01KGHXXFF6AQZA68MESVQVY7RA",
"DebitedWalletId": "wlt_m_01KGSJDM69VNXPKKGH1B3QFVFC",
"CreditedWalletId": "wlt_m_01KGSJ7GQY0P12EBB6XFAC866C",
"DebitedFunds": {
"Currency": "GBP",
"Amount": 1000
},
"CreditedFunds": {
"Currency": "EUR",
"Amount": 1067
},
"Fees": {
"Currency": "GBP",
"Amount": 70
},
"RequestedFees": {
"Type": "PERCENTAGE",
"Value": 700,
"Currency": "GBP"
},
"ResultCode": "000000",
"ResultMessage": "Success",
"ExecutionDate": 1770721018,
"ConversionRateResponse": {
"ClientRate": 1.13798,
"MarketRate": 1.1471573,
"FinalRate": 1.1209103
},
"MarginsResponse": {
"Mangopay": {
"Type": "PERCENTAGE",
"Value": 0.8,
"Amount": 8
},
"User": {
"Type": "PERCENTAGE",
"Value": 1.5,
"Amount": 16
}
},
"Tag": "Created using the Mangopay API Postman collection"
}
{
"AuthorId": "user_m_01KGHXXFF6AQZA68MESVQVY7RA",
"CreditedWalletId": "wlt_m_01KGSJ7GQY0P12EBB6XFAC866C",
"DebitedWalletId": "wlt_m_01KGSJDM69VNXPKKGH1B3QFVFC",
"DebitedFunds": {
"Currency": "GBP",
"Amount": 1000
},
"CreditedFunds": {
"Currency": "EUR"
},
"Fees": {
"Type": "PERCENTAGE",
"Value": 700,
"Currency": "GBP"
},
"UserMargin": {
"Type": "PERCENTAGE",
"Value": 1.5,
"Currency": "GBP"
},
"Tag": "Created using the Mangopay API Postman collection"
}
<?php
require_once '../vendor/autoload.php';
use MangoPay\MangoPayApi;
use MangoPay\Libraries\ResponseException as MGPResponseException;
use MangoPay\Libraries\Exception as MGPException;
use MangoPay\Money;
$api = new MangoPayApi();
$api->Config->ClientId = 'client-id';
$api->Config->ClientPassword = 'api-key';
$api->Config->TemporaryFolder = '../tmp/';
$api->Config->DebugMode = false;
try {
$instantConversion = new \MangoPay\Conversion();
$debitedUserId = "user_m_01HQK25M6KVHKDV0S36JY9NRKR";
$debitedWalletId = "wlt_m_01HQT7AS0FJPGYXDXJ0R151NBV";
$creditedWalletId = "wlt_m_01HQT6422EER2N7FPRXWTSDCSV";
$instantConversion->AuthorId = $debitedUserId;
$instantConversion->DebitedWalletId = $debitedWalletId;
$instantConversion->CreditedWalletId = $creditedWalletId;
$instantConversion->DebitedFunds = new Money();
$instantConversion->DebitedFunds->Amount = 100;
$instantConversion->DebitedFunds->Currency = "GBP";
$instantConversion->CreditedFunds = new Money();
$instantConversion->CreditedFunds->Currency = "EUR";
$instantConversion->Tag = "Created using the Mangopay PHP SDK";
$response = $api->Conversions->CreateInstantConversion($instantConversion);
print_r($response);
} catch(MGPResponseException $e) {
print_r($e);
} catch(MGPException $e) {
print_r($e);
}
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.Conversion;
import com.mangopay.entities.CreateInstantConversion;
public class CreatingInstantConversion {
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 debitedUserId = "user_m_01HQK25M6KVHKDV0S36JY9NRKR";
var debitedWalletId = "wlt_m_01HQT7AS0FJPGYXDXJ0R151NBV";
var creditedWalletId = "wlt_m_01HQT6422EER2N7FPRXWTSDCSV";
CreateInstantConversion instantConversion = new CreateInstantConversion();
instantConversion.setAuthorId(debitedUserId);
instantConversion.setCreditedWalletId(creditedWalletId);
instantConversion.setDebitedWalletId(debitedWalletId);
Money debitedFunds = new Money();
debitedFunds.setCurrency(CurrencyIso.GBP);
debitedFunds.setAmount(100);
Money creditedFunds = new Money();
creditedFunds.setCurrency(CurrencyIso.EUR);
Money fees = new Money();
fees.setCurrency(CurrencyIso.GBP);
fees.setAmount(10);
instantConversion.setCreditedFunds(creditedFunds);
instantConversion.setDebitedFunds(debitedFunds);
instantConversion.setFees(fees);
instantConversion.setTag("Created using the Mangopay Java SDK");
Conversion createInstantConversion = mangopay.getConversionsApi().createInstantConversion(instantConversion, null);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(createInstantConversion);
System.out.println(prettyJson);
}
}
Was this page helpful?
⌘I