Loan - Repayment
The following code example is provided to help you understand the business process. For commercial use, you must handle parameter validation and exception handling on your own.
This example is tested on the Polygon-Amoy chain. Information used in the example can be retrieved from the Source directory.
Code Example
Key Notes:
Order Hash: The
orderHash
must be retrieved from the creator's history API and is found in thef_order_hash
field.Redeem Amount: The redeem amount, including interest, is found in the
f_order_info/currency[0]/amountOrID
. Make sure the amount includes any applicable interest.Payment Token: If the repayment token is an ERC20 token, ensure that it has been approved for use with the contract and that there is a sufficient balance. If the repayment token is the network native token (e.g., MATIC), send it directly as part of the transaction using the
value
field in.send()
.
This code demonstrates how to initiate a repayment transaction on the Polygon-Amoy chain. Adjust the parameters as needed based on your specific requirements.
4o
Last updated