Monetize your Discord bots with Tipup!

Easily integrate Tipup payments to your Discord bot. Get started by choosing your bot's programming language.

1. Install NPM package

Get started with Tipup in Discord.js by installing our NPM package.

# NPM
npm install tipup-js --save

# Yarn
yarn add tipup-js

2. Generate API Key

Before running the following code example, add Tipup bot to same server and text channel as your bot.

Channel ID can be any text channel on the server where both Tipup bot and your bot can read messages.

User ID should be your personal discord user's id. The API key will be sent to the user in DM.

Please note that you only need to generate an API Key once. After generating the API Key, you can safely remove the usage of generateApiKey function.

import { createTipupClient } from "tipup-js";
import { Client } from "discord.js";

const client = new Client({ intents: ["Guilds", "GuildMessages"] });
const tipupClient = createTipupClient({ client });

client.once("ready", async () => {
  await tipupClient.startOneTimeSetup({
    channelId: "your-channel-id",
    userId: "your-discord-user-id"
  });
});

client.login("your-bot-token");

3. Request tokens

Streamline one-time payments. You can easily request tokens from a user. A hundred tokens is worth of 1 euro.

client.on("interactionCreate", async (interaction) => {
  if (!interaction.isButton()) return;
  
  const payment = await tipupClient.requestPayment({ 
    userId: interaction.user.id,
    tokens: 100,
  });
  
  if (payment.status === "PAID") {
    // Payment was successful
    // We should give the product to the user
  }  
});

4. Request a gift

Easily receive microtransactions. Similar to requesting tokens, the following snippet shows how to request gifts instead of tokens.

Gifts can be really useful for situations where you want to to charge user only a few cents.

client.on("interactionCreate", async (interaction) => {
  if (!interaction.isButton()) return;
  
  const payment = await tipupClient.requestPayment({ 
    userId: interaction.user.id,
    gift: "ROSE",
  });
  
  if (payment.status === "PAID") {
    // Payment was successful
    // We should give the product to the user
  }  
});