Counterparties

Counterparties are used in deposit and withdrawal operations and represent external accounts that funds are withdrawn to or pulled from (e.g. ACH Pull). They hold information about the counterparty such as:

  • supported payment rails/ methods
  • customer profile, if required
  • required account information, including asset type, account/ blockchain info.

There are 3 types of counterparties: Fiat US, Fiat US Linked, Crypto.

Fiat US

Fiat US counterparties are used for withdrawal of USD denominated Deposit accounts.

To create a FIAT US counterparty, use the counterparties endpoint. A single FIAT US counterparty can support multiple payment rails such as ACH, Fedwire.

Once the counterparty is successfully created, it can be used in a withdrawal on a USD denominated Deposit Account.

Crypto

As the name suggests, crypto counterparties are used for withdrawal of crypto from Deposit accounts.

To create a Crypto counterparty, use the counterparties endpoint. A single Crypto counterparty can only be used for withdrawal of one crypto/token.

Once the counterparty is successfully created, it can be used in a withdrawal on a crypto denominated Deposit Account.

Fiat US Linked

Fiat US Linked counterparties allow end users to link their US domiciled external accounts using MX. Linked counterpartes can then be used to pull funds (via ACH) from or push funds (via ACH) into these external accounts. A single Fiat US Linked counterparty can only support ACH at this time.

To create a Fiat US Linked counterparty, you have to follow the following steps

  1. Create the Counterparty of type FIAT_US_LINKED using the use the counterparties endpoint .
  2. Retrieve the MX Widget URL for this newly created Counterparty, using the counterparties/{COUNTERPARTY_ID}/link/details endpoint
  3. Pass in the MX Widget URL to the MX Widget script below. You will have to put this script into an iframe in your UI. For testing purposes in sandbox, you can also use our utility at https://mxmock.layer2financial.dev
Copy
Copied
<script src="https://atrium.mx.com/connect.js"></script>
    <script>
      var mxConnect = new window.MXConnect({
        id: "connect-widget", //id of where the widget will load into
        iframeTitle: "Connect",
        /**
         * Callback that for handling all events within Connect.
         * Only called in  ui_message_version 4 or higher.
         *
         * The events called here are the same events that come through post
         * messages.
         */
        onEvent: function(type, payload) {
          console.log("onEvent", type, payload);
        },
        config: {
          mode: "verification",
          color_scheme: "dark", //or "light"
          ui_message_version: 4
        },
        targetOrigin: "*"
      })
       mxConnect.load({MX_WIDGET_URL})
    </script>
  1. You will see the MX widget that looks something as follows in sandbox with 2 banks (MX Bank and MX Bank OAuth). In production, the end user will be able to search for their bank.

path

The user will select the bank, and enter their banking credentials in the screen below. Select Login as mxuser and password: P@ssword1. In Production, these would be the user's banking credentials.

path

As the last step, the user will have to select the bank account.

path

After a successful bank linking, you'll have an event fired that looks like this. Save the member_guid as you will need it for the next step.

path

  1. Retrieve a list of linkable accounts by using the counterparties/{COUNTERPARTY_ID}/link/accounts endpoint .

Save the account_link_id for the account you want to link as you will need it for the next step

  1. And finally, link the external account using the counterparties/{COUNTERPARTY_ID}/link/connect endpoint

And thats it! Your Fiat US Linked counterparty is now ready to be used in Deposits operations for an ACH pull or in ACH Withdrawal operations.

Note that you can only use a Fiat US Linked counterparty with DEPOSIT_FORT_FIAT accounts with asset type of FIAT_TESTNET_USD/FIAT_MAINNET_USD as its the only product type that supports ACH Push/Pull.

© 2023 Layer2 Financial Inc. All Rights Reserved.