Getting Started
Below we will walk through the process of creating your first product with a crypto subscription and getting it ready to sell.
Setup Options
There are a couple of different options for interacting with the ProductMint platform.
Dashboard
A web-based interface for creating and managing your products and subscriptions.

CLI
Command line interface tool for interacting with the ProductMint platform.
Direct Contract
Interact with the ProductMint contracts directly using our TypeChain SDK.
Setup Instructions
The steps below use the @product-mint/ethers-sdk
package. These are all direct interactions with the smart contracts powering the ProductMint system. Both the dashboard and the CLI tool use this package under the hood.
Install ProductMint SDK
npm
npm install @product-mint/ethers-sdk ethers
Configure RPC Provider
Set up an RPC provider to interact with the Ethereum network.
import { ethers } from 'ethers';
const provider = new ethers.providers.JsonRpcProvider('https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID');
Create Signer Wallet
Create a signer wallet that will be used to interact with the ProductMint smart contracts and submit the transactions.
import { ethers } from 'ethers';
const signerWallet = new ethers.Wallet('YOUR_PRIVATE_KEY', provider);
Never store your private key in your code. Always use environment variables and consider using an Organization Admin wallet to help reduce the risk of your organization being compromised.
Mint Organization NFT
Mint the Organization NFT to represent your organization. Get the Organization NFT contract address from contract addresses for the network you are using.
import { OrganizationNFT__factory } from '@product-mint/ethers-sdk';
const organizationNFT = OrganizationNFT__factory.connect(
'0x...', // Organization NFT contract address
provider,
);
await organizationNFT.connect(signerWallet).mint(
'0x...', // The address to mint the NFT to
);
Organization NFTs are free to mint and transferable. They are required to create products, manage subscriptions, and claim your revenue.
Create product
Products are what you are selling to your customers. Every product is completely independent allowing a customer to have multiple different products and subscriptions.
import { ProductRegistry__factory } from '@product-mint/ethers-sdk';
const productRegistry = ProductRegistry__factory.connect(
'0x...', // Product Registry contract address
provider,
);
await productRegistry
.connect(signerWallet)
.createProduct(
1, // The organization token ID
'Pro Plan', // The name of the product
'Unlock all features and get access to the Pro Plan.', // The description of the product
'https://example.com/image.png', // The image URL for the product
'https://example.com/external', // The external URL for the product
false, // Whether the product is transferable. If true, then the Product Pass NFT will be transferable and tradeable.
);
In order for your Product Pass NFTs to be transferable, all products on the NFT must be transferable along with any subscriptions being in a paused state.
Create pricing model
Pricing models are how you will charge your customers for your product. They can be one-time purchases or recurring subscriptions.
import { PricingRegistry__factory } from '@product-mint/ethers-sdk';
import { parseUnits } from 'ethers';
const pricingRegistry = PricingRegistry__factory.connect(
'0x...', // Pricing Registry contract address
provider,
);
await pricingRegistry
.connect(signerWallet)
.createFlatRateSubscriptionPricing({
organizationId: 1, // The organization token ID
flatPrice: parseUnits('10', 18), // The price of the product using the decimals of the token
token: '0x...', // The ERC20 token address to use for the subscription.
chargeFrequency: 2, // The charge frequency of how often the subscription will be charged. 0 (DAILY), 1 (WEEKLY), 2 (MONTHLY), 3 (QUARTERLY), 4 (YEARLY)
isRestricted: false, // Whether the pricing is restricted to only addresses that have been whitelisted
});
You can choose any ERC20 token to use for the subscription from the list of tokens that are supported.
Interested in using a dynamic token to have stable pricing in a volatile token? Learn more about them here.
Link pricing to product
In order to sell your product, you need to link a pricing model to the product. You can link multiple pricing models to a single product. Any pricing model can be linked to multiple products.
import { ProductRegistry__factory } from '@product-mint/ethers-sdk';
const productRegistry = ProductRegistry__factory.connect(
'0x...', // Product Registry contract address
provider,
);
await productRegistry
.connect(signerWallet)
.linkPricing(
10, // The product ID
[12, 21], // The pricing IDs
);
Ready to mint!
You are now ready to start selling your products and subscriptions by minting Product Pass NFTs. You can mint them directly from the contract on your website by calling the purchaseProducts
function on the PurchaseManager
contract.
import { PurchaseManager__factory } from '@product-mint/ethers-sdk';
const purchaseManager = new PurchaseManager(
'0x...',
provider,
);
await purchaseManager.connect(signerWallet).purchaseProducts(
{
to: '0x...', // Where to mint the NFT
organizationId: 1, // Organization token ID
productIds: [1], // Product IDs
pricingIds: [1], // Pricing IDs
quantities: [0], // Quantities (Used for TIERED pricing only. Else set to 0.)
discountIds: [], // Discount IDs (Optional)
couponCode: '', // Coupon Code (Optional)
airdrop: false, // Airdrop (Only allowed for Organization Owner/Admin)
pause: false, // Should any subscriptions be paused? (Must be enabled first)
},
);
Using a React based framework? Consider using WAGMI to write to the ProductMint contracts and providing the ABI via the @product-mint/ethers-sdk
package.
"use client";
import { useWriteContract } from "wagmi";
import { PurchaseManager__factory } from "@product-mint/ethers-sdk";
export const useMint = () => {
const { writeContract } = useWriteContract();
const mint = (address: `0x${string}`) =>
writeContract({
abi: PurchaseManager__factory.abi,
functionName: "purchaseProducts",
args: [
{
to: address,
organizationId: 1,
productIds: [1],
pricingIds: [1],
quantities: [0],
discountIds: [],
couponCode: "",
airdrop: false,
pause: false,
},
],
address: '0x...', // Purchase Manager contract address
});
};
A customer minting and portal website is in development for organizations to provide their customers with a way to purchase their Product Pass NFTs and manage their subscriptions. This will be available in the near future!
🎉 That’s all it takes to get started! 🎉
While it is significantly easier to use ProductMint than a traditional payment processor API, it is still a bit of work. If you are looking for an easier way to configure your products and pricing models, check out the dashboard .