Here you'll be able to get existing BNPL or Pawn Plans, fetch the next payment due, and make a payment on an existing Plan.

Get user plans

Call the getUserPlans method to get the pending, funded, active plans of the given address.

const userWallet = '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d';
const plans = await cyan.getUserPlans(userWallet);

Make a single payment on a Plan

To make a payment for an existing BNPL or Pawn Plan, call the pay method with the result from the getUserPlans method.

const plan = await cyan.pay({
	planId: 1234,
	paymentPlanContractAddress: '0xE803684B9E391D01Dc1cdF76baC9aE3A596B2ae0',
}); // You can pass single IPlan object returned from `getUserPlans`

Make all remaining payments on a Plan

const plan = await cyan.payEarly({
	planId: 1234,
	paymentPlanContractAddress: '0xE803684B9E391D01Dc1cdF76baC9aE3A596B2ae0',
}); // You can pass single IPlan object returned from `getUserPlans`

Get the next payment due in a Plan

If you want to get payment information for the plan, call the getPaymentInfo method to get the next payment information with the returned result of getUserPlans method.

const plan = await cyan.getPaymentInfo(
  {
    planId: 1234,
    paymentPlanContractAddress: '0xE803684B9E391D01Dc1cdF76baC9aE3A596B2ae0',
  }, // You can pass single IPlan object returned from `getUserPlans`
  false, // Optional boolean representing is early repayment or not
);