As the interaction is directly on-chain, this is not an endpoint. Steps to create a BNPL plan are detailed below!

📘

For the best experience, please refer to the SDK documentation. You'll be able to install our library and get started in not only creating BNPL plans but interacting with the Cyan Protocol as well.

In order to create a BNPL plan, call the createBNPLPaymentPlan function from the smart contract with data retrieved from the endpoint Retrieve a calculated BNPL plan.

📘

  • The PaymentPlan contract is available on Etherscan.
  • Cyan ABI is available on: Github

createBNPLPaymentPlan function accepts the following parameters:

FieldsDescription
addressCyan Wrapper address of the collection
tokenIdNFT id
amountPrice of the listing
interestRateInterest fee by rate
signedBlockNumThe last block number
termInterval between payments, expressed in seconds
serviceFeeRateFee rate of the service.
totalNumberOfPaymentsHow many payments need to be made.
signatureSignature created and provided by Cyan

Example:

const signer = this.provider.getSigner();
const calculatedData = {...} // from Retrieve a Calculated BNPL Plan

const contract = new Contract(
      paymentContractAddress, // Cyan payment contract address
      abi // Cyan ABI
      signer // signer from Web3
);

const transaction = await contract.createBNPLPaymentPlan(
      calculatedData.wrapperAddress,
      calculatedData.tokenId,
      calculatedData.price,
      calculatedData.interestRate,
      calculatedData.lastBlockNum,
      calculatedData.term,
      calculatedData.serviceFeeRate,
      calculatedData.totalNumOfPayments,
      calculatedData.signature,
      { value: calculatedData.downpaymentAmount }
);