Apply Different Fees based on Custom Field
In this example, we will walk you through creating a process that illustrates a product with two product levels - PRO and GREEN - with different fees applied on transactions. Mambu Process Orchestrator (MPO) calculates the fee to be applied and automatically debits it from the client account. A custom field is used to categorize the account as PRO or GREEN when a transaction is made.
Create the Process
1. Create an API consumer
Create an API consumer and generate an API key and a secret key in the Mambu UI. For more information on how to do this, see API Consumers. The API consumer should have the View Custom Fields permission enabled.
2. Create a custom field
Create a custom field on the deposit account level to categorize a product as PRO or GREEN, or any other labels that work for your use case. The custom field should be a standard custom field. For more information, see Setting up Custom Fields.
3. Deploy the MPO process
Download the process in the zip file below and deploy it to your MPO tenant.
4. Copy the webhook URL
Get the webhook URL from the Main Process (Link to mambu webhook)
process in the MPO UI. Open the process, click the Start node, and then click Copy webhook via JSON. For more information, see Trigger a Task using a Direct URL.
Add the webhook URL to the webhook created in the Mambu UI in the next step.
5. Create a webhook
Create a webhook for the transaction that applies the fee. In the example below, withdrawals are targeted. You can add the conditions you see fit for your use case. For more information, see Defining a New Webhook.
6. Add JSON to the webhook body
Add this JSON to the Webhook body field in the Mambu UI:
{
"accountId": "{ACCOUNT_ID}",
"amount": {TRANSACTION_AMOUNT},
"productType": "{CF:SAVINGS:PRODUCT TYPE}"
}
The values between the curly braces are placeholder text that is populated with data from each transaction. Adjust the productType
key-value pair to match the custom field name you created. In this example, this is {CF:SAVINGS:PRODUCT TYPE}
.
7. Run the setup process
Back in the MPO UI, manually trigger the task for the Setup process process in the Setup folder with the following parameters:
{
"mambuApiKey": "[Your Mambu API Key]",
"mambuConfigReference": "mambu",
"mambuUrl": "[Your Mambu Tenant URL]"
}
For more information on how to manually trigger a task, see Manually trigger a task in the MPO UI.
8. Adjust the product type and fee
If you would like to adjust the product type names and the fee percentage applied for use case, open the Main Process (Link to Mambu webhook)
process. Change the values of the nodes in the red boxes to adjust these values. Remember that the product type names need to be the same as the ones you set in the custom field in step 2.
9. Test the process
Test the process by creating two accounts with different productType
custom field values and creating transactions to trigger different fees.