Earn with Glide
If you're building dapps that faciliate transactions on protocols not owned by you, you can configure Glide to pay you a commission for each transaction. Using this approach, you can get paid for building amazing dapps on other protocols.
Setup
Before you start, make sure you have a working integration with Glide without commission. If you haven't done that yet, follow the Pay with Glide guide.
Steps
1. Provide commission payout address
During the Glide sign up process, you can provide a commission payout address where you would like to receive the commission.
Reach out to [email protected] to provide the commission payout address.
2. Add commission Glide transaction
Many Glide methods support a commissionUSD
field that can be used to specify the commission amount in USD.
For example, you can add a commission to the createSession
method like this:
import { createSession, executeSession chains } from "@paywithglide/glide-js";
import { config } from "./config";
const session = await createSession(config, {
chainId: chains.base.id,
account: "0xc6FfEB1298Eb33Da430d14e5Eb789256ec344625",
abi: fabricABI,
address: "0x1169c6769c4F4B3cA1944AF0F26B36582fd5279d",
functionName: "mintFor",
args: ["0xc6FfEB1298Eb33Da430d14e5Eb789256ec344625", 999999907200n],
value: 999999907200n,
commissionUSD: 2.50,
});
const { sponsoredTransactionHash } = await executeSession(glideConfig, {
session,
currentChainId: currentChainId,
switchChainAsync: async (chainId) => {
// switch current chain to chainId on the user's wallet
},
sendTransactionAsync: async (tx) => {
// send tx to the chain using the user's wallet
// // return the transaction hash
},
});
This will automatically add a commission of USD 2.50 to the payment transaction.
Similarly, you can add a commission to the listPaymentOptions
, createSession
, and estimatePaymentAmount
methods.
3. Payout
Commission will be paid out to the provided address daily.