This is not an endpoint, but a way to retrieve the next payment due on a plan, and make a payment.

📘

For the best experience, please refer to the SDK documentation. You'll be able to install our library and get started in not only retrieving the next payment on plans but also interacting with the Cyan Protocol.
We can make a payment using pay function from the smart contract.

In order to retrieve the next payment data, use the getPaymentInfoByPlanId function from the smart contract which uses returned data from the Retrieve user's Activated, Funded, and Pending Plans data.

getPaymentInfoByPlanId function accepts the following inputs:

FieldsDescription
planIdPlan ID
isEarlyRepaymentIs early repayment or not

After using getPaymentInfoByPlanId function from the smart contract and getting some of the data in the table.
We can use currentPayment to make a payment using pay function from the smart contract.

pay function accepts the following inputs:

FieldsDescription
planIdPlan ID
isEarlyRepaymentIs early repayment or not

Example:

const signer = ... // your Web3 signer
const contract = new Contract( // Contract from ether.js
       plan.paymentPlanContractAddress, // returned from Plan API
       abi, // Cyan ABI
       signer // Web3 signer
)
const planId = 1234;
const isEarlyRepayment = false;

// Retrieve the next payment due on a plan
const [
      payAmountForCollateral,
      payAmountForInterest,
      payAmountForService,
      currentPayment,
      nextPaymentDate,
    ] = await contract.getPaymentInfoByPlanId(planId, isEarlyRepayment);

// Make a payment
const res = await contract.pay(planId, isEarlyRepayment, {
      value: currentPayment
})