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 a Plan

Call the getPlan method to get the plan data for given NFT collection address (address) and Id(tokenId).

const plan = await cyan.getPlan(
  "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", // NFT address
  "3758" // NFT Id
);

Get the next payment due in a Plan

Call the getNextPayment method to get the next payment information with the returned result of getPlan method.

const plan = await cyan.getPlan(
  "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", // NFT address
  "3758" // NFT Id
);

const nextPaymentData = await cyan.getNextPayment(plan);

Make a payment on a Plan

To make a payment for an existing BNPL or Pawn Plan, call the pay method with the results from both the getPlan and getNextPayment methods.

const plan = await cyan.getPlan(
  "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d", // NFT address
  "3758" // NFT Id
);

const nextPaymentData = await cyan.getNextPayment(plan);

const res = await cyan.pay(
      plan,
      nextPaymentData.currentPayment
);