Bepaid

How to Connect

To connect the bePaid payment system, you will need a Store ID, secret key, and public key. Once you receive these credentials, proceed to the settings in Salebot.

circle-info

To obtain the Store ID, secret key, and public key, please contact baPaid technical support for assistance.

In MaviBot, open the "Payment system" section and select bePaid. Then enter the credentials you received.

Please note that the last field is a switch that selects the API hosting depending on the country of use: Belarus or Russia.

To generate a payment link, you need to set a value for the payment_sum variable (for example: 150 or 100.55 — use a dot as the decimal separator).

Once the payment_sum variable is set, the bepaid_pay_url variable will automatically appear. You can display this variable on the screen as a link or place it on a button with the text "Pay".

The payment link will look like this: https://checkout.bepaid.by/widget/hpp.html?token=a05eabd3f9368725efbc175614c7d469da08f198cc51916b07fb75e53f9a3e1aarrow-up-right

Before setting the payment_sum variable, you can also define the following optional variables to customize the payment.

circle-info

By default, the currency is set to Belarusian ruble. If you need to use a different currency, set a value for the currency variable.

Function Parameters
Description
More Information

currency

Payment currency in ISO 4217 format

For example: USD

language

Payment page language Default: en.

Allowed values:

  • en – English

  • es – Spanish

  • tr – Turkish

  • de – German

  • it – Italian

  • ru – Russian

  • zh – Chinese

  • fr – French

  • da – Danish

  • sv – Swedish

  • no – Norwegian

  • fi – Finnish

  • pl – Polish

  • ja – Japanese

  • uk – Ukrainian

  • be – Belarusian

  • ka – Georgian

  • ro – Romanian

payment_description

Payment Description

link_expired

Payment Link Expiration Set the expiration date in the format dd.mm.yyyy (for example: 25.06.2025). By default, the payment must be completed within 24 hours.

You can also use the "Assign Variables on Redirect" field to set:

  • link_expired = current_date + 2 — the link will be valid for 2 days until 00:00.

  • You can also specify an exact expiration date and time in the format dd.mm.yyyy hh:mm (for example: 25.06.2025 12:23). By default, the payment must be completed within 24 hours.

Standard variables can also be used. For example, to set the link validity to 30 minutes: time = current_time + 30 link_expired = "#{current_date} #{time}"

russian_host

Indicator for Store Registered on Russian bePaid Host Set this parameter to 1 if your store is registered on bepaid.tech.

If you need to switch the host to Belarus, set this parameter to "" (empty value).

test_payments

This variable is used for test payments. To perform a test payment, add it with any value.

bepaid_attempts

Specifies the number of payment attempts. By default, 1 attempt is allowed.

сustomer_data

An array containing the payer’s first_name, last_name, and email. This data is required to send the receipt to the payer’s email and can be edited on the payment page.

The parameter must be passed as a JSON-formatted list of key-value pairs. For example: customer_data = ‘{“first_name”: “Sam”, “last_name”: “Smith”, “email”: “[email protected]” }’

bepaid_contract (conditionally required)

Payment Purpose by Token

Expected values:

  • “recurring” – for regular payments with a set frequency

  • “card_on_file” – for one-time or irregular payments, e.g., post-payment for a service

After the payment is completed, the bepaid_callback_data variable will be added for the customer. It contains the payment system’s response for the completed transaction. You can extract the required data from this dictionary using the get method.

How to Test Payments

To perform a test payment, before setting the payment_sum variable, set the test_payments variable with any value. Remember to remove it when running the bot in live mode!

Test cards:

  • 4200000000000000 — success

  • 4005550000000019 — failed

If something doesn’t work, compare your data with the official documentation: https://docs.bepaid.by/ru/test-integration#test-card-numberarrow-up-right

Let’s create a payment link for 100 Belarusian rubles (default currency).

Note: first, set the additional variables for configuration, then set payment_sum. Variables can also be set earlier in the workflow, not necessarily in the same block — this is just an example.

Finally, display the bepaid_pay_url variable in the desired location; it contains the generated payment link.

Subscription Management

The payment system integration allows you to create subscriptions for your customers.

Before using this functionality in Salebot, create a subscription plan in your bePaid account.

circle-exclamation

Creating a Subscription and Generating a Payment Link

Use the get_bepaid_subscription_url function, passing the plan_id parameter, where…

plan_id

plan_id is the ID of the plan in the bePaid system.

As a result, the function will create a subscription and return a payment link.

Send the link to the customer and wait for the payment to be completed.

Once the payment is successful, the subscription will be activated. The deal will receive the bepaid_subscription_id and bepaid_subscription_status variables, and a callback will be sent to the bot (see the “How to Handle the Result” section).

Retrieving Subscription Information

To get the current subscription details for a customer, call the get_bepaid_subscription_info function and pass the subscription_id parameter (the value can be taken from the bepaid_subscription_id variable).

Cancelling a Subscription

To cancel a subscription, use the cancel_bepaid_subscription function.

This function accepts a single parameter: subscription_id (the value can be taken from the bepaid_subscription_id variable).

Upon successful cancellation, the bepaid_subscription_status variable will be set to “canceled”, and a callback will be sent to the bot (see the “How to Handle the Result” section).

Subscription Statuses

trial

Active or canceled trial period subscription.

active

Active subscription with payment made on time.

failed

Failed subscription. bePaid was unable to process the next payment.

error

An error occurred while bePaid was attempting to process the payment.

canceled

Subscription has been canceled and is no longer active.

Recurring Payments

You can also set up a subscription system without creating a plan in your bePaid account.

For this, you will need the customer’s card token.

To obtain the card token, the customer must make an initial payment using a link generated via payment_sum.

Before setting the payment_sum value, set the bepaid_contract variable to specify the purpose of future payments by token:

  • “recurring” – for regular payments with a set frequency

  • “card_on_file” – for one-time or irregular payments, e.g., post-payment for a service

circle-exclamation

After a successful payment, the bepaid_client_card_token variable will be added to the deal, storing the customer’s card token. This token allows you to charge the customer’s card without their involvement.

Next, set up your funnel and specify a date or condition for automatic charging, then call the make_bepaid_token_payment function, passing the required parameters.

Parameter order: amount → currency → description → contract

Parameter Descriptions

amount (required)

Payment amount – expected value is an integer or decimal number, for example: 100 or 100.5.

currency (required)

Payment currency in ISO 4217 format, for example: “USD”.

description (required)

Description of the charge, for example: “Weekly subscription payment for participation in the hobby club”.

contract (required)

Payment purpose by token. Expected values: “recurring” or “card_on_file”.

circle-exclamation

If the payment is successful, the function will return the message “Successful charge via bePaid token”, you will receive a callback for the successful payment, and the deal variable bepaid_token_payment_completed will be set to “True”.

If the payment fails, the function will return a message indicating the reason for the failed payment, a callback with the suffix “_fail” will be sent to the bot, and the deal variable bepaid_token_payment_completed will be set to “False”.

circle-exclamation

How to Handle the Result

In response to customer actions, the bot will receive callbacks consisting of the first 20 characters of the secret key and a suffix, which depends on the type and outcome of the operation.

In the system, the callback appears as a message from the user, but the user does not see it.

For Payments

For payments not related to subscriptions, you will receive one of the following messages:

  • keyNumber_success – for a successful payment

  • keyNumber_fail – for a failed payment

You can also track the status of the last payment using the variables:

  • bepaid_payment_completed – for payments involving the customer

  • bepaid_token_payment_completed – for card token-based automatic payments

For Subscriptions

After a subscription is successfully activated, either on the first or a recurring payment, the bot will receive the message keyNumber_success.

If the subscription is canceled, you will receive keyNumber_canceled.

In the case of a failed subscription payment, the message keyNumber_fail will be sent.

Last updated