Skip to content

Subscriber Balance in Chat Bot

Working with contact balance in bot: topping up and debiting funds from balance

Topping up your clients' balance for future purchases in the bot

As you may know, our service allows accepting payments in bots. Usually clients select a product or service and follow a link to a payment system to complete a purchase. But sometimes you need the client to top up their balance and then spend it on purchases in the bot. Based on this need, we began implementing this feature.

Topping up balance

Method 1. Create a payment block for any payment system, for example YooKassa, open its settings and check "Credit money to user account".

balance in bot

Crediting funds to contact account via payment block

Tag user who purchased in bot

Funds will now be credited to the user's account. First, an account will be created for them in the currency you configured for the payment system. The list of accounts can be viewed in: Lists > Contacts > Required Contact

balance in bot

Managing accounts in contact card

balance in bot

A transaction log is kept for each account:

balance in bot

Transaction log

Method 2.
Use the "Top up contact account" block

Top up contact account

Method 3. Go to the user card, select the "Accounts" section, click "+" to top up balance. Then specify the amount and description.

balance in bot

Topping up balance from "Accounts" section in contact card

balance in bot

Topping up balance from "Accounts" section in contact card

Method 4. Using the "Credit referrer reward" block.

Credit referrer reward

Method 5. Using the LEADTEX chat bot API.

Debiting funds (purchase)

Method 1. Use the "Debit from contact account" block

Debit from contact account

Method 2. Go to the user card, select the "Accounts" section, click "-" to debit balance. Then specify the amount and description.

balance in bot

Debiting balance from "Accounts" section in contact card

balance in bot

Debiting balance from "Accounts" section in contact card

Method 3. Using the LEADTEX chat bot API.

Current API (application programming interface) capabilities:

  1. Getting list of accounts.
  2. Creating account by ISO 4217 currency code
  3. Deleting account
  4. Topping up account
  5. Debiting funds from account

Displaying balance in bot

To display the client's balance, add the following function call to the bot message: {{ getBalance("USD") }}, where USD is the currency code.

balance in bot

Function for displaying contact balance

Bonus for new users and the opportunity to get 500 rubles in points as a gift 🎁

  • Register on LEADTEX
  • Create and test your first project
  • Don't miss the special offer. Get a gift 👈