https://discord.gg/botpress logo
How to Charge User for Using the Bot?
# 🤝help
i
Hello Bot Builders, does anyone know how to set up a payment system to charge users to use a bot, ideally on a __subscription basis__? I understand I would probably need to (1) assign a Unique ID to each user, and (2) link the user to some 3rd party payment system. But I am completely ignorant of both subjects. If anyone knows how to do this or can point me to some tutorials (non-programmer level, please...) I would be truly grateful. Many thanks in advance!
n
Each user already have a unique userId
l
Not straight forward, but here is what you will need to do As @narrow-flag-58313 mentioned, each user has a unique userId in Botpress, event.userId will provide the userId, or if you are using channels like WhatsApp or Telegram, etc, these channels also have their own IDs to identify a user. You may have to store this somewhere, like Botpress tables, for your billing purposes. Additionally, refer to the documentation of your payment solution provider that you are integrating with, and call their respective functions or endpoints to get the payment link Pass the payment link to the user to pay. update the record of the user that you stored with the information you need to store about this payment(in the same table or another table) Based on the payment, perform the next actions
i
Thank you again!
Thank you again! I am capable of finding and storing the Unique User ID in a Table. But linking it to a third-party payment solution and then linking it back to update each ID's record is not something I can figure out on my own. Do you know if there is any detailed tutorial for it—if it is possibly manageable on my own, or if there is a template I can copy or buy, or if I can hire someone shortly for this task? Thank you so much for always answering me!
l
I am sure you will find something over the internet. Every payment solution has their own implementation, so it is important to understand the providers solution that you are using. In a nutshell the process works by either creating and order and then a payment link or just a payment link. The payment link payload will include details like userId, conversationId etc along with the payment information. You will also have to setup Botpress Webhook (you will find that in the integration section, search for Webhook). This webhook URL has to be configured in your payment providers portal to receive information once a payment is received. In the webhook trigger, you will receive the payload which should contain the information you passed when creating a payment link along with the payment details, which you can then tie back to the conversation. Note: one of the first steps when a payload is received at webhook is to extract the conversationId and attach it back to event.conversationId for the bot to know for which conversation the payload was received
i
Thank you so much, but it reads a bit difficult for my level... I have found that BotPress has Stripe and Square Integration (although the latter is not yet available). I may just need someone to show me how to use the ready-to-use integration 🥲 I miss @bumpy-butcher-41910 's tutorial for non-programmers dearly and wholeheartedly...
l
I can help you setup tomorrow
i
Thank you for saving me! I will ask the question at the Office Hour in a bit. If I still can't learn, I will see you tomorrow! My time zone is CET 🙂
Yesssss, pleeeeease help me! The tutorial lady has 0 clue about the subject... What is your time zone and when is a convenient moment of yours?
l
I am in IST
i
When is a good time for you? I am avaialble after 11:30 am your time, and my schedule is flexible except 3:30 to 5:30 pm your time 🙂
l
Will ping
i
Thank you and looking forward!
@limited-pencil-78283 Hi Lijo, just say that I have tried again and figured out some basics. My remaining question is: (1) can a Bot automatically detect if a user is a return customer who have subscribed? It means can it NOT CHECK the user's identity each time he/she starts a chat? (2) is the Stripe's record automatically linked to the Unique User ID in Bot Press, or how to set it up? Many thanks 🙂
Based on our conversation Yesterday, follow this post outcome for your answers to identify users on webchat
5 Views