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
- If you don't specify any command in the request, both the creation and execution of the transfer will be done within the system.
- Example: POST https://api.cloud.mbanq.com/v1/transfers
- If you include the command parameter, such as "command=create," only the transfer will be created and will be in draft status. After the draft, it will need to be executed separately.
- Example: POST https://api.cloud.mbanq.com/v1/transfers?command=create
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:
Parameter | Value Type | Definition |
---|---|---|
query | String | The GraphQL query specifying the mutation operation and its parameters. |
mutation | String | The type of GraphQL operation, indicating that it is a mutation. |
createTransfer.input.type | String | The type of the transfer, e.g., "CREDIT". |
createTransfer.input.paymentType | String | The payment type of the transfer, e.g., "SWIFT". |
createTransfer.input.currency | String | The currency of the transfer, e.g., "USD". |
createTransfer.input.amount | Float | The amount of the transfer. |
createTransfer.input.dateFormat | String | The date format used for displaying dates. |
createTransfer.input.reference | Array | An array of references for the transfer. |
createTransfer.input.debtor.identifier | String | The identifier of the debtor's account. |
createTransfer.input.creditor.identifier | String | The identifier of the creditor's account. |
createTransfer.input.creditor.name | String | The 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.
Parameter | Value Type | Definition |
---|---|---|
data | Object | The data object containing the result of the transfer creation. |
createTransfer | Object | The object representing the created transfer. |
createTransfer.id | String | The 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.
Parameter | Value Type | Definition |
---|---|---|
type | String | The type of the transfer, e.g., "DEBIT". |
paymentType | String | The payment type of the transfer, e.g., "RDC". |
currency | String | The currency of the transfer, e.g., "USD". |
fileUrl | String | The URL pointing to the file containing transfer information. |
amount | Float | The amount of the transfer. |
instantFunds | Integer | Specifies if the transfer should be processed as an instant fund transfer. |
debtor.identifier | String | The identifier of the debtor's account, e.g., "RDC". |
creditor.identifier | String | The identifier of the creditor's account, e.g., "ACCOUNT:9510010000059393". |
creditor.name | String | The name of the creditor. |
creditor.accountType | String | The type of the creditor's account, e.g., "CHECKING". |
reference | Array | An array of references for the transfer. |
transferDetails.checkFrontImage | String | The base64-encoded image data of the front side of the check associated with the transfer. |
transferDetails.checkBackImage | String | The 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.
Parameter | Value Type | Definition |
---|---|---|
data | Object | The data object containing the result of the transfer creation and submission. |
createAndSubmitTransfer | Object | The object representing the created and submitted transfer. |
createAndSubmitTransfer.id | String | The ID of the created and submitted transfer. |
createAndSubmitTransfer.externalId | String | The 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.
Updated 11 months ago