Skip to main content

Technical integration with Stripe payment system: how to accept payments from customers

In order for your clients to purchase access to your AI Expert, you need to connect your BuddyPro instance to your payment system. This allows you to automate sales, subscription and access management.

19.1 Integration with Stripe

A) Link your Stripe account to your BuddyPro instance:

  • In your BuddyPro instance (in a Telegram chat with your AI Expert), enter the following command:

    /setupStripe
  • After successfully entering this command, your BuddyPro instance will send you a link. Click on that link to connect your Stripe account with Buddy Pro. If you don’t have a Stripe account yet, you will be able to create one.

B) Example Buddy Pro products will be generated

  • Buddy will generate 4 products for you, together with example pricing and payment links:
    • Monthly subscription: $149 / month → 1000 messages per month
    • Quarterly subscription: $399 / 3 months → 1000 messages per month
    • Annual subscription: $1149 / year → 1000 messages per month
    • Extra Messages: $69 → 500 additional messages with no expiration
      • ⚠️ IMPORTANT: Packages are only for existing subscribers who run out of monthly messages. They cannot be purchased without an active subscription.
  • You can find the generated products here: https://dashboard.stripe.com/products
  • You can find the generated payment links here: https://dashboard.stripe.com/payment-links

C) Adjust the pricing, monthly messages limits and name of the products according to your needs. Or create your own products and payment links if needed.

  • If you want to change price of the example product, you must create a new Price on the product and then create a new payment link, choosing that price.

  • Your Buddy Pro products inside Stripe must always have these metadata fields, which identify them as a Buddy Pro product (already set for the example products):

    case: buddy_pro
    messages: 200 (any number, up to you)

    Screenshot 2025-12-11 at 19.35.03.png

  • The value 'messages' is a monthly limit of messages in a conversation (for subscriptions) or how many total messages are granted to the user (for packages).

  • Both messages from user and from Buddy are counted towards the limit.

  • The monthly limit is applied also on annual/quarterly subscriptions to avoid using up too many messages during a single month.

  • Messages bought in a package do not have an expiration date.

  • ‼️ When you’re creating your own product for a package, you need to allow creating a Post-payment invoice in the payment link settings

    • How to enable Post-payment invoice
      1. After you’ve created a product and a payment link, go to the payment link settings, and click edit:

        Screenshot 2025-09-22 at 19.04.50.png

      2. Go to the After payment tab, enable Create an invoice PDF and click Update link.

        Screenshot 2025-09-22 at 19.05.12.png

D) Additional commands to manage invoices:

  • /processStripePaymentManually:{paidInvoiceId}
    • This command is used to process the payment manually if automatic processing via webhook fails for some reason. Only use it if your BuddyPro instance or support prompts you to do so.

⚠️ WARNING ON MANUAL ADJUSTMENTS IN STRIPE: We strongly advise against making manual adjustments in Stripe to automatically issued (especially recurring) invoices to your clients for BuddyPro services (e.g. manually changing the billing period, moving the due date, adjusting the price on an already issued invoice, etc. without a deep understanding of how the integration works and what the implications may be). The BuddyPro platform may not be aware of these manual changes you are making in Stripe and may not sync with them properly, which can lead to issues with activating or deactivating access for the client.

Frequently Asked Questions (FAQ) for Stripe:

  • How is the Buddy Pro subscription or package delivered to the user who buys it?
    • After the user buys your subscription or package, we automatically send them an activation email from our server with a button to activate their purchase.
    • If user is buying from within the Telegram chat with your Buddy Pro, the purchase might be activated automatically without the need to click on the activation email.
  • What if I want to offer multiple tariffs on one of my web pages (signposting)?
    • If a user comes to your signpost from BuddyPro (e.g. after exhausting the trial), it is crucial that the client_reference_id parameter from the original URL is carried over to the Stripe payment links leading from the signpost to the individual Stripe checkouts. For more detailed information on this technical solution, see Step 20.3 Important Solution for Multi-Tariff ROSTERS.

note

👇

If you implemented Stripe, continue to the next step and skip the FAPI alternative.


STRIPE ALTERNATIVE:

19.2 Integration with alternative payment system FAPI (fapi.cz)

FAPI is a robust Czech online sales and billing platform that is currently fully integrated with BuddyPro.

warning

If you are using Stripe (recommended), you can skip this step, this is an alternative to Stripe.

A) Preparation on the FAPI side (if you don't use FAPI yet):

  1. Create an account on FAPI: If you don't have one yet, you can register via this link : https://fapi.cz/
  2. Set up FAPI: Connect FAPI to your payment gateway (e.g. GoPay, Comgate, Stripe). This is the standard FAPI setup.

B) Link your main FAPI account to your BuddyPro instance:

  • In your BuddyPro instance (in a Telegram chat with your AI Expert), enter the following command once for basic linking:

    /setupFapi:{username}:{apikey}
    • Replace {username} with your login name (login/email) to your FAPI account.
    • Replace {apikey} with your API key from FAPI. You can find (or re-generate) the API key in your FAPI account under My Account > API Keys.
  • After successfully entering this command, your BuddyPro instance is able to communicate with your FAPI account.

C) Create products (items) and sales forms in FAPI:

  • For each of your planned plans (e.g., "AI Expert Monthly Standard", "AI Expert Annual Premium") and for each of your planned extra message packages ("100 Extra Message Package"), you must create two items in FAPI:

    1. Product (Item): create it in the FAPI section "Sales" -> "Products". Here you define the product name (e.g. "AI Expert Subscription - Monthly") and its price.
    2. Sales Form: create it in the FAPI section "Sales" -> "Sales Forms". You then assign the product (item) you created to this form. Here you also set up the payment methods (for subscriptions we strongly recommend to enable only credit card for smooth automatic renewals), the texts on the form, etc.
  • ⚠️ Key settings in FAPI for SUBSCRIPTION products:

    • "Issue regular invoices": must be checked.
    • "Enable automatic card charge": it is strongly recommended to check it so that the subscription can be automatically renewed.
    • Set the correct billing period (monthly, yearly, etc.).

    These options can be configured in Step 3 of the Sales Form settings.

D) Link a specific FAPI sales form to a specific plan/package in your BuddyPro instance:

  • For each individual FAPI sales form you have created (i.e., each tariff and each report package), you must enter a specific linking command in your BuddyPro instance:

    /connectForm:{id}:{productId}:{type}:{messages}
    • Replace {id} with the actual ID of your FAPI form. This ID is easy to find - when you have the form open in your FAPI administration, look at the URL in your browser. It will look something like this: https://web.fapi.cz/forms/preview/12345 (or it may contain .../update/12345). The number at the end ( 12345 in this example) is the form ID.
    • Replace {productId} with the actual product (item) ID in the FAPI that is being sold on this particular form. You can find the product ID in FAPI under "Templates" -> "Items" in the list of your created products.
    • Replace {type} with the product type that is sold on this form:
      • subscription - if it is a regular (monthly, yearly, etc.) subscription.
      • package - if this is a one-time purchase of a package of extra reports.
    • Replace {messages} with the number of messages the user will receive by purchasing this product:
      • For subscription type: enter the monthly number of messages (e.g. 1000). This monthly limit applies even if it is an annual subscription (the limit is renewed every month).
      • For package type: enter the total number of messages included in this one-time package (e.g. 200).
  • Example of linking a monthly subscription form with 1000 messages: /connectForm:12345:67890:subscription:1000

  • After successfully entering this command, BuddyPro will verify the existence of the form and product in your FAPI and save this link. It will also show you information in the response that you need to set up the thank you page and email correctly in your FAPI (see next key point).

E) Setting up the THANKS PAGE and CONFIRMATION EMAIL in FAPI - absolutely crucial for automatic access activation!

  • In order to automatically activate (or extend/increase) a user's access to your AI Expert in BuddyPro after a successful payment in FAPI, the user must click on a special activation link after payment . This link must be placed on the FAPI form thank you page and also in the confirmation email that FAPI sends after payment.
  • How do I get the activation link? The exact format of this link will be communicated to you by your BuddyPro instance just after you have successfully linked the FAPI form using the /connectForm command (see previous point D). The link will be unique to your instance and will contain special placeholders.
  • 1. Setting up the THANKS PAGE in FAPI:
    • In the FAPI administration, open the settings for your specific sales form.
    • Find the section related to the "Thank You Page". Important: Do not redirect to a custom URL on your site, but edit directly the text of the Thank You Page that is generated in FAPI.
    • Include a clear call to action and your unique activation link obtained from BuddyPro in the Thank You Page text that appears after a successful payment (usually under the {{ifPaid}} condition or similar that FAPI allows).
    • This activation link will contain a placeholder for the invoice number, typically in the format {{number}} (for FAPI). It's absolutely crucial that this placeholder is in the link exactly like this! FAPI will then automatically replace it with the actual invoice number issued.
    • Example text on the FAPI thank you page:Thank you for ordering access to our AI Expert! To activate your account immediately and start the conversation, please click HERE.
  • 2. Configure the CONFIRMATION EMAIL in FAPI:
    • In the FAPI administration, go to the email template settings.
    • Create a new email template (or carefully edit an existing one) that will automatically be sent to the user upon successful payment for your BuddyPro product.
    • In the text of this email template, too, include a clear call to action and the unique activation link (with {invoiceNumber} variable).
    • Recommendation: for each of your BuddyPro instances (if you have more than one) and ideally for each master plan as well, it's a good idea to have your own specific set of email templates in FAPI to make communication as clear as possible. Don't use a one-size-fits-all template for all your products if you sell things other than a specific BuddyPro service.
  • Why is this so important? Clicking on this special activation link (which contains unique payment identifiers) will redirect the user to Telegram, where the BuddyPro platform will recognize that a payment has been made, identify the user (or allow them to link the payment to their Telegram account if they have been shopping "anonymously" without prior interaction with your AI), and automatically activate the appropriate plan or message package for them. Access is not automatically activated without this click!

F) Additional commands to manage already linked FAPI forms (entered into your BuddyPro instance):

  • /getFormMessages:{form_id}
    • Shows you the maximum number of messages currently set for a FAPI form with the given {form_id}.
  • /updateFormMessages:{form_id}:{new_message_count}
    • Allows you to change the maximum number of messages for an already linked FAPI form.
    • Important: This change will only take effect for new users who purchase a product through this form after this change has been made. It will not affect message limits for existing users who purchased the product previously with the original settings.
  • /processFapiPaymentManually:{paidInvoiceNumber}
    • This command is used to process the payment manually if automatic processing via webhook fails for some reason. Only use it if your BuddyPro instance or support prompts you to do so.

⚠️ WARNING ON MANUAL ADJUSTMENTS IN FAPI: We strongly advise against making manual adjustments in FAPI to automatically issued (especially recurring) invoices to your clients for BuddyPro services (e.g. manually changing the billing period, moving the due date, adjusting the price on an already issued invoice, etc. without a deep understanding of how the integration works and what the implications may be). The BuddyPro platform may not be aware of these manual changes you are making in FAPI and may not sync with them properly, which can lead to issues with activating or deactivating access for the client. Always try to manage tariffs and payments primarily through the standard FAPI interface and linking commands in BuddyPro.

Frequently Asked Questions (FAQ) for FAPI:

  • Why is it necessary to have a separate FAPI sales form for each plan or message package?
    • The /connectForm command allows you to link only one specific FAPI form to one specific message count setting and product type (subscription/package) in BuddyPro at any given time. Therefore, to function properly and distinguish what the client is buying, it is necessary to have a separate form for each plan offered.
  • What if I accidentally link the wrong product ID or form ID in the /connectFormcommand ?
    • Simply re-enter the /connectForm command with the correct information. The new link will overwrite the previous one for that form ID. Always check carefully to make sure you are using the correct IDs.
  • Do I need to put the activation link on the FAPI thank you page AND in the FAPI confirmation email?
    • Yes, this is very strongly recommended. This will give the user two options to activate access and minimize the risk of the link being overlooked or lost.
  • Does a variable other than {invoiceNumber} in the activation linkwork for FAPI?
    • No, in order for the FAPI link to work properly, the activation link must contain a placeholder exactly in the format {invoiceNumber}.
  • What if I want to offer multiple tariffs on one of my web pages (signposting)?
    • If a user comes to your signpost from BuddyPro (e.g. after exhausting the trial), it is crucial that the userId parameter from the original URL is carried over to the links leading from the signpost to the individual FAPI forms. For more detailed information on this technical solution, see Step 20.3 Important Solution for Multi-Tariff ROSTERS.
  • Where exactly can I find the form ID and product ID in the FAPI?
    • Form ID: In the FAPI administration, go to the "Forms" section. In the list of your forms or when editing a specific form, you will see the form ID in the browser URL (e.g. https://web. fapi.cz/forms/view/XXXXX, where XXXXX is the ID).
    • Product ID (Items). In the list of your products (items) you will see their ID.