> ## 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.

# View a Mandate

### Path parameters

<ParamField path="MandateId" type="string" required>
  The unique identifier of the mandate.
</ParamField>

### Responses

<AccordionGroup>
  <Accordion title="200">
    <ResponseField name="Scheme" type="string">
      The scheme of the mandate, which is available once the mandate is submitted. The value can be one of the following: 

      * BACS – Covers payments in the UK, in GBP only.
      * SEPA – Covers payments in the EU.
    </ResponseField>

    <ResponseField name="BankAccountId" type="string">
      The unique identifier of the bank account.

      **Warning:** The <a href="/api-reference/bank-accounts/bank-account-object">Bank Account</a> `Type` must be IBAN for the SEPA scheme and GB for the Bacs scheme.
    </ResponseField>

    <ResponseField name="BankReference" type="string">
      The banking reference for the Mandate.
    </ResponseField>

    <ResponseField name="Culture" type="string">
      **Returned values:** One of the supported languages in the <a href="/api-reference/overview/data-formats">ISO 639-1 format</a>: DE, EN, ES, FR, IT, NL, PL

      The language in which the mandate confirmation page is to be displayed. This value only applies to mandates with the SEPA `Scheme`.
    </ResponseField>

    <ResponseField name="DocumentURL" type="string">
      The URL at which the mandate document can be downloaded.
    </ResponseField>

    <ResponseField name="ReturnURL" type="string">
      Max. length: 220 characters

      The URL to which the user is returned after the payment, whether the transaction is successful or not.
    </ResponseField>

    <ResponseField name="RedirectURL" type="string">
      The URL to which to redirect the user to complete the payment.

      **Caution:** This variable URL is specific to each payment. You must rely on the returned URL in full (host, path, and queries) and not hardcode any part of it.
    </ResponseField>

    <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="CreationDate" type="Unix timestamp">
      The date and time at which the object was created.
    </ResponseField>

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

      The status of the mandate:

      * `CREATED` – The mandate has been generated but not yet confirmed.
      * `SUBMITTED` – The mandate has been confirmed and sent to the user's bank, and can be used to request a direct debit pay-in.
      * `ACTIVE` – The mandate has been accepted by the user's bank or successfully used to process a direct debit direct pay-in. Further pay-ins can be requested.
      * `FAILED` – The mandate has been canceled or otherwise failed, and can no longer be used for payments.
      * `EXPIRED` – No payment has been made against the mandate in the last 24 months. It can no longer be used for payments.
    </ResponseField>

    <ResponseField name="UserId" type="string">
      The unique identifier of the user.
    </ResponseField>

    <ResponseField name="ExecutionType" type="string">
      **Returned values:** `WEB`

      The execution type of the mandate.
    </ResponseField>

    <ResponseField name="MandateType" type="string">
      The type of the mandate.
    </ResponseField>

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

      Custom data that you can add to this object.
    </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>
  </Accordion>
</AccordionGroup>

<ResponseExample>
  ```json 200   theme={null}
  {
      "Scheme": "SEPA",
      "BankAccountId": "bankacc_m_01J999AWHFHW2PQ1ADNQ46AYE9",
      "BankReference": "QYDZMNP",
      "Culture": "EN",
      "DocumentURL": "https://api.sandbox.mangopay.com/webhook/eu/public/mandates/e8a73d/dfbdce2a12a442bfae973e56777b3ddb/document?version=2.01",
      "ReturnURL": "http://example.com?MandateId=mdt_m_01J999B9HSEDH9CZDEXXYZGHEZ",
      "RedirectURL": "https://api.sandbox.mangopay.com/mvc/eu/public/mandates/e8a73d/dfbdce2a12a442bfae973e56777b3ddb/confirmation?version=2.01",
      "Id": "mdt_m_01J999B9HSEDH9CZDEXXYZGHEZ",
      "CreationDate": 1727962392,
      "Status": "SUBMITTED",
      "UserId": "user_m_01J8SY95DQ5CM7DH43NQCAS65T",
      "ExecutionType": "WEB",
      "MandateType": "DIRECT_DEBIT",
      "Tag": "Created using the Mangopay API Postman collection",
      "ResultCode": null,
      "ResultMessage": null
  }
  ```
</ResponseExample>

<RequestExample>
  ```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;

  $api = new MangoPayApi();

  $api->Config->ClientId = 'your-client-id';
  $api->Config->ClientPassword = 'your-api-key';
  $api->Config->TemporaryFolder = 'tmp/';

  try {
      $mandateId = '194612261';

      $response = $api->Mandates->Get($mandateId);

      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: 'your-client-id',
    clientApiKey: 'your-api-key',
  })

  let myMandate = {
    Id: '169718609',
  }

  const getMandate = async (mandateId) => {
    return await mangopay.Mandates.get(mandateId)
      .then((response) => {
        console.info(response)
        return response
      })
      .catch((err) => {
        console.log(err)
        return false
      })
  }

  getMandate(myMandate.Id)  
  ```

  ```ruby Ruby   theme={null}
  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 viewMandate(mandateId)
      begin
          response = MangoPay::Mandate.fetch(mandateId)
          puts response
          return response
      rescue MangoPay::ResponseError => error
          puts "Failed to fetch mandate: #{error.message}"
          puts "Error details: #{error.details}"
          return false
      end
  end

  myMandate = {
      Id:'194337135'
  }

  viewMandate(myMandate[:Id])  
  ```

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

  public class ViewMandate {
      public static void main(String[] args) throws Exception {
          MangoPayApi mangopay = new MangoPayApi();
          mangopay.getConfig().setClientId("your-client-id");
          mangopay.getConfig().setClientPassword("your-api-key");

          Mandate mandate = mangopay.getMandateApi().get("mdt_m_01HW2Z09A391QW5EPWTSEKDWTR");

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

          System.out.println(prettyJson);
      }
  }
  ```

  ```python Python   theme={null}
  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 Mandate

  mandate_id = '214058486'

  try:
      view_mandate = Mandate.get(mandate_id)
      pprint(vars(view_mandate))
  except Mandate.DoesNotExist:
      print('The Mandate {} does not exist.'.format(view_mandate.id))  
  ```

  ```csharp .NET  theme={null}
  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 mandateId = "mdt_m_01J3D1C35QZHHAT7XJ4WXTHRTJ";

          var viewMandate = await api.Mandates.GetAsync(mandateId);

          string prettyPrint = JsonConvert.SerializeObject(viewMandate, Formatting.Indented);
          Console.WriteLine(prettyPrint);
      }
  }
  ```
</RequestExample>
