Custom Marketplace Contracts
Paper supports marketplace contracts where a user can list an NFT and receive funds when a buyer purchases it.
Integration is identical to other checkout projects. Replace the mintMethod
with your smart contract's "buy" method that does the following:
- Accepts the wallet address where the NFT should be delivered.
- Accepts payment in the chain's native coin or USDC.
- Transfers the NFT from the seller to the recipient's wallet address. Remember:
msg.sender
is Paper's minter wallet and not the buyer's wallet address. - If this method should not be called by other buyers, consider restricting calls to Paper
Reservoir Platform
Reservoir is a set of developer tools to build custom marketplaces. You can use Paper to create NFT checkouts on any of their supported marketplace types (OpenSea, X2Y2, Rarible, and more!).
Use cases
- You want your buyers to be able to purchase an NFT on your site from listings found on Opensea.
- You want your buyers to be able to purchase an NFT on your site (regardless of which marketplace it may be listed on).
Prerequisites
- A valid listing on one of the supported marketplaces. Make a note of the NFT contract address and token ID.
- Goerli, Ethereum, and Polygon (beta) are currently supported.
Integration
- Register your contract on the Developer Dashboard: Contracts page.
- Set your Contract Type to Reservoir.
- Leave Contract Address blank.
- Create a 🔐 One-Time Checkout Link.
Code sample
const body = {
contractId: "RESERVOIR_CONTRACT_ID",
title: "My Paper Checkout",
contractArgs: {
// TIP! You can add more than 1 token to the nfts array and we'll accept all of those listings!
nfts: [
{ token: `COLLECTION_CONTRACT_ADDRESS_1:TOKEN_ID_1` },
{ token: `COLLECTION_CONTRACT_ADDRESS_2:TOKEN_ID_2` }
]
},
};
const resp = await fetch("https://withpaper.com/api/2022-08-12/checkout-link-intent", {
method: "POST",
headers: [
"Authorization": "Bearer MY_PAPER_API_KEY",
"Content-Type": "application/json",
]
body: JSON.stringify(body);
});
const { checkoutLinkIntentUrl } = await resp.body();
// Navigate users to this URL to purchase your NFT.
Please update the following variables:
RESERVOIR_CONTRACT_ID
: The Contract ID from Step 1.COLLECTION_CONTRACT_ADDRESS
: The contract address of the NFT collection.TOKEN_ID
: The token ID of the NFT from the listing. This listing must exist on one of Reservoir's supported marketplaces.MY_PAPER_API_KEY
found on Developer Dashboard: Developers.
For a more embedded checkout experience, sell marketplace NFTs with Checkout Elements.
FAQ
Which marketplaces can Paper purchase from?
See the complete list of supported marketplaces and chains. See Contract Args: Reservoir for more details.