eligibilityMethod

👍

eligibilityMethod is optional and used for custom contracts only.

The eligibilityMethod in the Checkout APIs instructs Paper to check if the buyer is eligible to purchase this NFT.

Use cases

At the start of the checkout before taking the buyer's payment, show the buyer an error if:

  • The contract has an allowlist and the buyer's wallet address is not on it.
  • The sale period has not started or has already ended.
  • The buyer is trying to purchase more than is allowed per wallet address.
  • The NFT is sold out.

Example

Here's an example eligibility method on the NFT contract:

function checkClaimEligibility(address _to, uint256 _quantity) external view returns (string memory) {
  if (paused) {
    return "Sale is not live";
  } else if (_quantity > numMints[_to]) {
    return "Max mints per wallet exceeded";
  } else if (totalSupply() + _quantity > maxSupply) {
    return "Not enough supply";
  }
  return "";
}

If the buyer is eligible, return an empty string.

Otherwise, any string returned suggests the buyer is not eligible to purchase, and Paper will show this reason to the buyer.

The eligibilityMethod should be:

"eligibilityMethod": {
  "name": "checkClaimEligibility",
  "args": {
    "_to": "$WALLET",
    "_quantity": "$QUANTITY"
  }
}

Template variables

The following template variables will be replaced when calling your contract:

VariableReplaced with
$WALLETThe buyer's wallet address.
$QUANTITYThe quantity selected by the buyer.

FAQ

Where do I provide the eligibilityMethod?

For Shareable Checkout Links:

For Dynamic One-Time Checkout Links: In the Create Dynamic One-Time Checkout Link API.

For Checkout Elements: In the Create Checkout Elements Client Secret API.