Tutorial: Transfer API

Introduction to the MBanq Cloud Transfer API:

📘

API Reference for Transfers API's and Webhooks

The MBanq Cloud Transfer API is a powerful endpoint that enables developers to perform various types of payments across different payment rails. It is a crucial component for initiating and managing transfers within the MBanq ecosystem. To utilize the Transfer API effectively, developers should also have a solid understanding of webhook subscriptions and their functionality.

The Transfer API allows you to create, submit, and manage transfers. It supports different payment types such as SWIFT, ACH, RDC, and more. By leveraging this API, you can seamlessly handle funds and facilitate secure and efficient payment transactions.

In this tutorial, we will walk you through the steps involved in creating transfers and performing various operations using the MBanq Cloud Transfer API.

📘

Command Values in Transfer Requests

Let's get started with the step-by-step process:

Create Transfer

The first step in creating a transfer is to initiate it as a draft. The following code snippet demonstrates how to create a transfer from a current account to another account via SWIFT network:

curl -X POST https://api.cloud.mbanq.com/graphql \
     -H "Content-Type: application/json" \
     -d '{
         "query": "mutation {
             createTransfer(
                 input: {
                     type: \"CREDIT\",
                     paymentType: \"SWIFT\",
                     currency: \"USD\",
                     amount: 1.23,
                     dateFormat: \"YYYY-MM-DD\",
                     reference: [\"subject\"],
                     debtor: { identifier: \"ACCOUNT:000000012\" },
                     creditor: { identifier: \"SWIFT://XYZBUS33ODE/1235380002\", name: \"Aaron\" }
                 }
             ) {
                 id
             }
         }"
     }'

This table provides an overview of the parameters used in the given cURL statement for creating a transfer via GraphQL. Each parameter has a corresponding value type and a definition that clarifies its purpose in the transfer creation process:

ParameterValue TypeDefinition
queryStringThe GraphQL query specifying the mutation operation and its parameters.
mutationStringThe type of GraphQL operation, indicating that it is a mutation.
createTransfer.input.typeStringThe type of the transfer, e.g., "CREDIT".
createTransfer.input.paymentTypeStringThe payment type of the transfer, e.g., "SWIFT".
createTransfer.input.currencyStringThe currency of the transfer, e.g., "USD".
createTransfer.input.amountFloatThe amount of the transfer.
createTransfer.input.dateFormatStringThe date format used for displaying dates.
createTransfer.input.referenceArrayAn array of references for the transfer.
createTransfer.input.debtor.identifierStringThe identifier of the debtor's account.
createTransfer.input.creditor.identifierStringThe identifier of the creditor's account.
createTransfer.input.creditor.nameStringThe name of the creditor.

This table provides an overview of the parameters used in the given data object. Each parameter has a corresponding value type and a definition that clarifies its purpose in the context of transfer creation.

ParameterValue TypeDefinition
dataObjectThe data object containing the result of the transfer creation.
createTransferObjectThe object representing the created transfer.
createTransfer.idStringThe ID of the created transfer.

If the request is successful, the response will contain the transfer ID:

{
    "data": {
        "createTransfer": {
            "id": "6"
        }
    }
}

Create and Submit Transfer
Once a transfer is created as a draft, the next step is to submit it. The following code snippet demonstrates how to create and submit a transfer:

curl -X POST https://api.cloud.mbanq.com/graphql \
     -H "Content-Type: application/json" \
     -d '{
         "query": "mutation {
             createAndSubmitTransfer(
                 input: {
                     type: \"DEBIT\",
                     paymentType: \"RDC\",
                     currency: \"USD\",
                     fileUrl: \"s3://ach-494813966229/VirtualAccounts_v3 Mbanq 20210811093333_1628847858771.json\",
                     amount: 10,
                     instantFunds: 1,
                     debtor: { identifier: \"RDC\" },
                     creditor: { identifier: \"ACCOUNT:9510010000059393\", name: \"CORY L STOKES\", accountType: CHECKING },
                     reference: [\"US TREAS 303::CORY L STOKES DES:SOC SEC ID:467570876A SSA INDN:CORY L STOKES CO ID:3031036030 PPD\"],
                     transferDetails: { checkFrontImage: \"data:image/image/png;base64,iVBORw..\", checkBackImage: \"data:image/image/png;base64,iVBORw..\" }
                 }
             ) {
                 id
                 externalId
             }
         }"
     }'

This table provides an overview of the parameters used in the given cURL statement for creating and submitting a transfer via GraphQL. Each parameter has a corresponding value type and a definition that clarifies its purpose in the transfer creation and submission process.

ParameterValue TypeDefinition
typeStringThe type of the transfer, e.g., "DEBIT".
paymentTypeStringThe payment type of the transfer, e.g., "RDC".
currencyStringThe currency of the transfer, e.g., "USD".
fileUrlStringThe URL pointing to the file containing transfer information.
amountFloatThe amount of the transfer.
instantFundsIntegerSpecifies if the transfer should be processed as an instant fund transfer.
debtor.identifierStringThe identifier of the debtor's account, e.g., "RDC".
creditor.identifierStringThe identifier of the creditor's account, e.g., "ACCOUNT:9510010000059393".
creditor.nameStringThe name of the creditor.
creditor.accountTypeStringThe type of the creditor's account, e.g., "CHECKING".
referenceArrayAn array of references for the transfer.
transferDetails.checkFrontImageStringThe base64-encoded image data of the front side of the check associated with the transfer.
transferDetails.checkBackImageStringThe base64-encoded image data of the back side of the check associated with the transfer.

If the request is successful, the response will contain the transfer ID and external ID:

{
    "data": {
        "createAndSubmitTransfer": {
            "id": "14241",
            "externalId": "1639540243013ig"
        }
    }
}

This table provides an overview of the parameters used in the given data object. Each parameter has a corresponding value type and a definition that clarifies its purpose in the context of the created and submitted transfer.

ParameterValue TypeDefinition
dataObjectThe data object containing the result of the transfer creation and submission.
createAndSubmitTransferObjectThe object representing the created and submitted transfer.
createAndSubmitTransfer.idStringThe ID of the created and submitted transfer.
createAndSubmitTransfer.externalIdStringThe external ID of the created and submitted transfer.

OTP Request

To submit a transfer, an OTP (One-Time Password) is required. You can request the OTP using the following code snippet:

curl -X POST https://api.cloud.mbanq.com/graphql \
     -H "Content-Type: application/json" \
     -d '{
         "query": "mutation {
             requestOTP(param: { deliveryMethod: \"email\", extendedToken: false }) {
                 requestTime
                 expirationTime
             }
         }"
     }'

If the request is successful, you will receive an email containing the OTP code for submitting the transfer request.

Submit Transfer

Once you have received the OTP code, you can submit the transfer using the following code snippet:

curl -X POST https://api.cloud.mbanq.com/graphql \
     -H "Content-Type: application/json" \
     -H "OTP-Token: EK76S" \
     -d '{
         "query": "mutation {
             submitTransfer(id: 6) {
                 id
             }
         }"
     }'

If the request is successful, the response will contain the transfer ID:

{
    "data": {
        "submitTransfer": {
            "id": "6"
        }
    }
}

This concludes the tutorial for using the MBanq Cloud Transfer API. By following these steps, you can create, submit, and manage transfers efficiently, enabling seamless payment transactions across various payment rails with MBanq.