> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mangopay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Quoted Conversion between user Wallets

This call triggers a conversion at the rate defined in its quote. The debited funds (buy currency), credited funds (sell currency) and currencies are defined in the quote.

Each quoted conversion requires a dedicated [Quote](/api-reference/quotes/quote-object) object, linked in the `QuoteId`.

### Body parameters

<ParamField body="QuoteId" type="string" required>
  The unique identifier of the active quote which guaranteed the rate for the conversion.
</ParamField>

<ParamField body="AuthorId" type="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.
</ParamField>

<ParamField body="DebitedWalletId" type="string" required>
  The unique identifier of the debited wallet (in the sell currency).
</ParamField>

<ParamField body="CreditedWalletId" type="string" required>
  The unique identifier of the credited wallet (in the buy currency).
</ParamField>

<ParamField body="Tag" type="string">
  Max. length: 255 characters

  Custom 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.
</ParamField>

### Responses

<AccordionGroup>
  <Accordion title="200 - Succeeded">
    <ResponseField name="Id" type="string">
      Max length: 128 characters (see [data formats](/api-reference/overview/data-formats) for details)

      The unique identifier of the object.
    </ResponseField>

    <ResponseField name="QuoteId" type="string">
      The unique identifier of the active quote which guaranteed the rate for the conversion.

      Returned `null` in the case of an instant conversion.
    </ResponseField>

    <ResponseField name="Type" type="string">
      The type of transaction.
    </ResponseField>

    <ResponseField name="Nature" type="string">
      **Returned values:** `REGULAR`, `REPUDIATION`, `REFUND`, `SETTLEMENT`

      The 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.
    </ResponseField>

    <ResponseField name="CreationDate" type="Unix timestamp">
      The date and time at which the object was created.
    </ResponseField>

    <ResponseField name="Status" type="string">
      **Returned values:** `CREATED`, `SUCCEEDED`, `FAILED`

      The status of the transaction.
    </ResponseField>

    <ResponseField name="AuthorId" type="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.
    </ResponseField>

    <ResponseField name="DebitedWalletId" type="string">
      The unique identifier of the debited wallet (in the sell currency).
    </ResponseField>

    <ResponseField name="CreditedWalletId" type="string">
      The unique identifier of the credited wallet (in the buy currency).
    </ResponseField>

    <ResponseField name="DebitedFunds" type="object">
      Information about the debited funds.

      <Expandable title="properties">
        <ResponseField name="Currency" type="string">
          **Returned values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

          The currency of the debited funds (the sell currency).
        </ResponseField>

        <ResponseField name="Amount" type="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`. 
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="CreditedFunds" type="object">
      Information about the credited funds.

      <Expandable title="properties">
        <ResponseField name="Currency" type="string">
          **Returned values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

          The currency of the credited funds (the buy currency).
        </ResponseField>

        <ResponseField name="Amount" type="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`. 
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="Fees" type="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.

      <Expandable title="properties">
        <ResponseField name="Currency" type="string">
          **Returned values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

          The currency of the fees.
        </ResponseField>

        <ResponseField name="Amount" type="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`).
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="RequestedFees" type="object">
      Information about the `Fees` sent in the request.

      <Expandable title="properties">
        <ResponseField name="Type" type="string">
          **Allowed values:** `PERCENTAGE`, `FIXED`

          **Default value:** `FIXED`

          The type of the `Value`.
        </ResponseField>

        <ResponseField name="Value" type="integer">
          The value to be used for the `Type`:

          * `PERCENTAGE` – In quantities of 0.1% (e.g. `150` equals 1.5%), the percentage of `DebitedFunds.Amount` deducted as fees.
          * `FIXED` – The amount deducted from `DebitedFunds.Amount` as fees, as 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`).
        </ResponseField>

        <ResponseField name="Currency" type="string">
          **Allowed values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

          The currency of the fees, which must match the debited currency.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="ResultCode" type="string">
      The code indicating the result of the operation. This information is mostly used to <a href="/errors/codes">handle errors</a> or for filtering purposes.
    </ResponseField>

    <ResponseField name="ResultMessage" type="string">
      The explanation of the result code.
    </ResponseField>

    <ResponseField name="ExecutionDate" type="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`.
    </ResponseField>

    <ResponseField name="ConversionRateResponse" type="object">
      Information about the `MarketRate` used to convert funds and other indicative rates.

      <Expandable title="properties">
        <ResponseField name="ClientRate" type="float">
          Max. 7 decimal places

          The 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`.
        </ResponseField>

        <ResponseField name="MarketRate" type="float">
          Max. 7 decimal places

          The 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.
        </ResponseField>

        <ResponseField name="FinalRate" type="float">
          Max. 7 decimal places

          The 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`.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="Tag" type="string">
      Max. length: 255 characters

      Custom 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.
    </ResponseField>
  </Accordion>
</AccordionGroup>

Functional errors (`ResultCode`) are possible on a 200 response. <a href="/errors/codes#fx-conversions">Read more</a> **→**

***

<AccordionGroup>
  <Accordion title="400 - Quote required for Quoted Conversion">
    ```json theme={null}
    {
        "Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
        "Type": "param_error",
        "Id": "ffaf5ad6-d9f1-47bf-832c-ea5da626037e",
        "Date": 1706192320,
        "errors": {
            "QuoteId": "Quote not found"
        }
    }  
    ```
  </Accordion>

  <Accordion title="400 - Quote expired">
    ```json theme={null}
    {
        "Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
        "Type": "param_error",
        "Id": "31dc86e1-783e-4e34-94d0-4e1891fd74bb",
        "Date": 1707301282,
        "errors": {
            "QuoteId": "The quote is expired"
        }
    }  
    ```
  </Accordion>

  <Accordion title="400 - Quote already used">
    ```json theme={null}
    {
        "Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
        "Type": "param_error",
        "Id": "2b989396-3dc7-4fcf-8a7e-2c6463262633",
        "Date": 1707301113,
        "errors": {
            "QuoteId": "The quote is already consumed"
        }
    }  
    ```
  </Accordion>

  <Accordion title="400 - Credited currency doesn’t match quote">
    ```json theme={null}
    {
        "Message": "Credited currency incompatibility.",
        "Type": "currency_incompatibility",
        "Id": "47ade3b3-0c5d-4c32-ae11-1cfd23720a11",
        "Date": 1707314958,
        "errors": null
    }  
    ```
  </Accordion>

  <Accordion title="400 - Debited currency doesn’t match quote">
    ```json theme={null}
    {
        "Message": "Debited currency incompatibility.",
        "Type": "currency_incompatibility",
        "Id": "f83e073e-287d-4781-bbba-87256dad4aa0",
        "Date": 1707315285,
        "errors": null
    }  
    ```
  </Accordion>

  <Accordion title="400 - Author is not debited wallet owner">
    ```json theme={null}
    {
        "Message": "Author 204071581 is not debited wallet 214818911 owner.",
        "Type": "author_is_not_debited_wallet_owner",
        "Id": "c16cb140-0f02-4c5f-a705-9cfdb11fb499",
        "Date": 1708382645.0,
        "errors": null
    }  
    ```
  </Accordion>

  <Accordion title="400 - Author is not credited wallet owner ">
    ```json theme={null}
    {
        "Message": "Author 204071581 is not credited wallet 214818911 owner.",
        "Type": "author_is_not_credited_wallet_owner",
        "Id": "5586bf7e-8e33-4e7a-a140-107f7a9e3a26",
        "Date": 1708382704.0,
        "errors": null
    }  
    ```
  </Accordion>
</AccordionGroup>

<ResponseExample>
  ```json 200 - Succeeded   theme={null}
  {
      "Id": "cvr_01KH3JAVX32DNZ2141BFMERP5V",
      "QuoteId": "cvrquote_01KH3J69K96FXNMQ875PTDJ13A",
      "Type": "CONVERSION",
      "Nature": "REGULAR",
      "CreationDate": 1770720161,
      "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": 1770720162,
      "ConversionRateResponse": {
          "ClientRate": 1.1360925,
          "MarketRate": 1.1471047,
          "FinalRate": 1.1190511
      },
      "MarginsResponse": {
          "Mangopay": {
              "Type": "PERCENTAGE",
              "Value": 0.96,
              "Amount": 10
          },
          "User": {
              "Type": "PERCENTAGE",
              "Value": 1.5,
              "Amount": 16
          }
      },
      "Tag": "Created using the Mangopay API Postman collection"
  }
  ```
</ResponseExample>

<RequestExample>
  ```json REST   theme={null}
  {
      "QuoteId": "cvrquote_01HP1H6EK4H39SCQ8WJ349WMBB",
      "AuthorId": "204071581",
      "DebitedWalletId": "204079338",
      "CreditedWalletId": "209408867",
      "Tag": "Created using the Mangopay API Postman collection"
  }  
  ```

  ```php PHP  theme={null}
  <?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 { 
      $quotedConversion = new \MangoPay\Conversion();

      $debitedUserId = "user_m_01HQK25M6KVHKDV0S36JY9NRKR";
      $debitedWalletId = "wlt_m_01HQT7AS0FJPGYXDXJ0R151NBV";
      $creditedWalletId = "wlt_m_01HQT6422EER2N7FPRXWTSDCSV";

      $quoteId = "cvrquote_01JE92SJATA0X9YXNXKP9N1VFT";

      $quotedConversion->QuoteId = $quoteId;
      $quotedConversion->AuthorId = $debitedUserId;
      $quotedConversion->DebitedWalletId = $debitedWalletId;
      $quotedConversion->CreditedWalletId = $creditedWalletId;
      $quotedConversion->Tag = "Created using the Mangopay PHP SDK";

      $response = $api->Conversions->CreateQuotedConversion($quotedConversion);

      print_r($response);
  } catch(MGPResponseException $e) {
      print_r($e);
  } catch(MGPException $e) {
      print_r($e);
  }
  ```

  ```javascript NodeJS  theme={null}
  const mangopayInstance = require('mangopay4-nodejs-sdk');
  const mangopay = new mangopayInstance({
      clientId: "client-id",
      clientApiKey: "api-key"
    })

  let myConversion = {
      QuoteId: "cvrquote_01JDHAEJF2QRC0MZ6WTJHETDQZ",
      AuthorId: "user_m_01HQK25M6KVHKDV0S36JY9NRKR",
      DebitedWalletId: "wlt_m_01HT2J9Q2M6GMFW4Z7GYBAFJ4T",
      CreditedWalletId: "wlt_m_01HQT7AS0FJPGYXDXJ0R151NBV",
      Tag: "Created using the Mangopay NodeJS SDK"
  }
    
  const createQuotedUserConversion = async (conversion) => {
  return await mangopay.Conversions.createQuotedConversion(conversion)
      .then((response) => {
      console.info(response)
      return response
      })
      .catch((err) => {
      console.log(err)
      return false
      })
  }
    
  createQuotedUserConversion(myConversion)
  ```

  ```java Java   theme={null}
  import com.google.gson.Gson;
  import com.google.gson.GsonBuilder;
  import com.mangopay.MangoPayApi;
  import com.mangopay.entities.Conversion;
  import com.mangopay.entities.CreateQuotedConversion;

  public class CreatingQuotedConversion {
      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";

          var quoteId = "cvrquote_01J1YPZQXF6A5AAG7YCZAM9D9N";

          CreateQuotedConversion quotedConversion = new CreateQuotedConversion();
          
          quotedConversion.setQuoteId(quoteId);
          quotedConversion.setAuthorId(debitedUserId);
          quotedConversion.setDebitedWalletId(debitedWalletId);
          quotedConversion.setCreditedWalletId(creditedWalletId);
          quotedConversion.setTag("Created using the Mangopay Java SDK");

          Conversion createQuotedConversion = mangopay.getConversionsApi().createQuotedConversion(quotedConversion, null);

          Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
          String prettyJson = prettyPrint.toJson(createQuotedConversion);

          System.out.println(prettyJson);
      }
  }
  ```
</RequestExample>
