This is a brief workflow of creating BNPL plans.

To use Cyan's BNPL feature, follow these steps.

  1. Pricer Step 1
  2. Pricer Step 2
  3. Create BNPL Plans
  4. Make a payment

📘

Info

In order to create a BNPL plan, a user wallet address is required. This is due to the fact Cyan will create a unique signature and return it as a requirement to initiate the BNPL plan via smart contracts. The signature is automatically generated and will return in the response request for BNPL prices.

There are four steps in the BNPL plan process. They are:

  1. Create Cyan Wallet
  2. Fund the NFT purchase
  3. Purchase the NFT
  4. Activate the loan

For step 1, a new wallet will be created if the user does not have a Cyan Wallet yet (ERC-1271 smart contract wallet). A small gas fee is associated with the creation.

In step 2, funds are requested from the respective Cyan Vault. If the risk is appropriate and the funds are available, ETH (or ERC-20) will be sent to the admin wallet to execute the purchase of the NFT. Occasionally, new plans may be rejected at this step if the risk is intolerable or the user is trying to take advantage in some manner (wash trade, etc.).

In step 3, the admin wallet makes the purchase of the NFT and initiates the transfer of the NFT to the protocol.

Lastly in step 4, the NFT is transferred to the user's newly created Cyan Wallet and their downpayment settles and moves to the respective vault. The loan commences after settlement on the blockchain.


A batch plan is when multiple BNPL loans are executed in one transaction. This will be utilized when users "sweep the floor" or purchase multiple NFTs in a batch plan to save on gas and time.

To create a batch plan, the user needs to have a Cyan Wallet. The SDK handles wallet creation internally, but if you want to do it manually, you can retrieve the user's Cyan Wallet using the getCyanWallet method and create a wallet using the createCyanWallet method.


If the plan uses a non-native currency, the user must provide permission for that currency on the Cyan protocol. The SDK handles currency permissions internally, but you can also trigger it manually using the checkAndAllowCurrencyForPlan method.

1. Pricer Step 1

BNPL pricer accepts a currency address and an array of NFT items as input and returns possible loan options.

const pricingOptions = await cyan.priceBnplsStep1(
  '0x0000000000000000000000000000000000000000',
  [
    {
      address: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
      tokenId: "3758",
      itemType: 1,
      amount: 0,
      price: "10000000000" // Optional price field, if not passed, Cyan will price an item
    },
  ], // NFTs array
);

📘

When your users initiate a deal on Cyan, they automatically agree to the Terms & Conditions of Cyan. We have an optional signable step you may elect to implement on your front end to make it clear to the user what happens if they miss a payment.

2. Pricer Step 2

After user selects the loan option returned from first step, user should pass selected option to pricer 2 and gets the data required to create a BNPL Plan.

const plans = await cyan.priceBnplsStep2({
  wallet: '0x8589D5276833407C37d139D3d0007340C7131cd3',
  items: [{
    address: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d',
    tokenId: '3758',
    itemType: 1,
    amount: 0,
  }], // Array of the IItemsWithPrice object returned from pricer step 1
  option: {
    term: 3600,     // Duration between payments in seconds
    loanRate: 5000, // Loaning rate multiplied by 100
    totalNumberOfPayments: 4, // Total number of payments
  }, // User's selected option, must be one of the options returned from step 1.
  currencyAddress: '0x0000000000000000000000000000000000000000',
  autoRepayStatus: 0,
});

3. Create BNPL Plans

To create a BNPL Plan, call the createBnpls method with returned data from the second step of the pricer.

const currencyAddress = '0x0000000000000000000000000000000000000000';
const plans = [...]; // Array of the successfully priced plans from step 2
const payFromCyanWallet = false;
               
const result = await cyan.createBnpls(
  currencyAddress,
  plans, 
  payFromCyanWallet // Optional boolean representing whether to pay the downpayment using the original wallet or not (only works for native currency)
);

4. Make a Payment

To make the next payment in a created BNPL Plan, please follow the steps in Plans.