πŸ“‹ Overview

Upfront integration allows your players to purchase NFTs with full payment in a single transaction. The NFT is transferred directly to the user with no restrictions, wrapping, or installment tracking required.

βœ… Integration Requirements

  • βœ“
    ERC721/ERC1155 Compliance
    Your NFT collection must follow standard ERC721 or ERC1155 interfaces.
  • βœ“
    Marketplace Integration
    Your marketplace must be able to call the MersoUpfront contract.
  • βœ“
    No wNFT Required
    Upfront purchases transfer the original NFT directlyβ€”no WrappedNFT support needed.

πŸ“ Contract Interface

MersoUpfront Interface

Solidity
interface IMersoUpfront {
    // Purchase an NFT with full upfront payment
    function buyTokenFrom(
        address originalCollection,
        uint256 tokenId,
        uint256 tokenPrice,
        address tokenAddress
    ) external;
    
    // Check if a collection is allowed
    function isAllowedCollection(
        address collection
    ) external view returns (bool);
}

πŸ’» Integration Example

Frontend Integration

JavaScript
import { ethers } from 'ethers';
import MersoUpfront_ABI from './abis/MersoUpfront.json';

const MERSO_UPFRONT_ADDRESS = '0x...'; // Provided during onboarding

async function purchaseUpfront(collection, tokenId, price, paymentToken) {
    const provider = new ethers.providers.Web3Provider(window.ethereum);
    const signer = provider.getSigner();
    
    // 1. Approve full payment amount
    const tokenContract = new ethers.Contract(paymentToken, ERC20_ABI, signer);
    await tokenContract.approve(MERSO_UPFRONT_ADDRESS, price);
    
    // 2. Execute upfront purchase
    const mersoContract = new ethers.Contract(MERSO_UPFRONT_ADDRESS, MersoUpfront_ABI, signer);
    const tx = await mersoContract.buyTokenFrom(
        collection,
        tokenId,
        price,
        paymentToken
    );
    
    await tx.wait();
    console.log('Upfront purchase complete! Original NFT transferred to user.');
}

βš–οΈ Upfront vs PNPL Comparison

Feature Upfront PNPL
Payment Amount 100% upfront 50% upfront + 4 weekly
NFT Received Original NFT WrappedNFT (then original)
Transfer Restrictions None During payment period
Integration Complexity Lower Higher (wNFT support)