Wayforpay
Quick registration and merchant confirmation
Merchant registration for individuals without a website
Unified percent for individuals and legal entities – 2.5%
Availability of Google play and ApplePay
How to connect
To connect the wayforpay payment system, you will need 3 values:
merchant's login
merchant's secret key
the domain name of the merchant's website.
Go to your personal account -> store settings https://m.wayforpay.com/mportal/merchant/list

Copy the data and go to the settings in Mavibot.
Open the "Acquiring" section, select wayforpay.

You need to enter the received data in the form that opens:

To generate a payment link, you need to set the value of the payment_sum variable (for example, 150 or 100.55, if the amount is fractional, then the amount is separated by a dot):

Immediately after that, the wayforpay_pay_url variable will appear. This variable can be displayed in the message with a link or placed on the button with the text "Pay":
Option 1. The payment link in the button:

Option 2. The payment link is in the attachment url field:

The link looks like:
https://secure.wayforpay.com/invoice/id1bbb2ad0375
By default, USD (dollars) is set, if you need another currency, you need to set the value of the currency variable.
Also, before setting the value of the payment_sum variable, you can set the following optional variables to configure the payment.
currency - is the default currency of the order, UAH (possible values are USD, EUR, RUB)
session_timeout - Link lifetime in seconds, default is 3600 (1 hour)
product_name - product name
language - payment page language, the default is UA (possible values are RU, EN) buyer_name - customer name
buyer_email - customer email
buyer_first_name - customer name
buyer_last_name - customer last name
This is how the payment page has a link.
Let's create a link for payment in the amount of 1 USD and a lifetime of 2 hours:

Pay attention: - First, specify the optional parameters product_name ad etc. - And the last, assign the value of the payment_sum variable.
Please note that we first set the variables for the settings, then payment_sum. Variables can be set earlier in the chain, rather than in a single block, this is an example.
Next, in the next block, we output the wayforpay_pay_url variable, which contains a link (for example, a link in the text):

The bot will work as follows:

How to process the result
After a successful payment, callbacks will be sent to the bot, which will let you know that the payment was successful. You see these callbacks in the system as messages from the user, so that the user cannot send them, they consist of the first 10 characters of the secret key and the postscript _success, for example: flk3409ref_success

These callbacks are NOT VISIBLE to the user, they are displayed only to the operator.
The type of comparison should be "Complete Match"
Also, after successful payment, the wayforpay_payment_completed variable is set to True.
For example, you can process a successful payment in a conditional block and display the corresponding message to the user:


If you do not want to knock the client out of the main chatbot scheme, use the "Non state with a condition" block. You cannot go to this block, so the client will not be knocked out of the main funnel after payment and will receive a notification of successful payment.
And if you need to continue the funnel with a reaction to a successful payment, then use the "Start condition" block, then the client will move from the payment block to the "Start condition" block, from which you can continue the funnel.
More information about conditional blocks is provided in the article of the same name
After the payment is completed, the wayforpay_callback_data variable will be added to the client, containing the data of the payment system's response to the completed transaction. You can extract the necessary data from the resulting dictionary using the get method.
Functions for working with the calculator
For recurring payments
wayforpay_recurrent_payment(amount, currency, session_timeout, product_name, language, buyer_name, buyer_email, regular_date_next, regular_date_end, regular_count, regular_mode) - generates a link for a recurring payment.
amount
payment amount
currency
currency. Default: UAH (possible values: USD, EUR, RUB). Optional parameter.
session_timeout
link lifetime in seconds. Default: 3600 (1 hour). Optional parameter.
product_name
product name. Optional parameter.
language
payment page language. Default: UA (possible values: RU, EN). Optional parameter.
buyer_name
customer name. Optional name.
buyer_email
Customer email. Optional parameter.
regular_date_next
next automated transaction date. Default: one month after the link is created. Optional parameter.
regular_date_end
automated transaction end date. Default: one year after the link is created. Can be omitted if the regular_count parameter is specified. Optional parameter.
regular_count
number of automated transaction. If specified, the regular_date_end parameter will be ignored. Optional parameter.
regular_mode
recurring payment interval. Optional parameter. Possible values: - once - one-time payment - daily - daily - weekly - weekly - quarterly - every 3 months after the first payment date - monthly - once a month - bimonthly - once every 2 months - halfyearly - рonce every 6 months - yearly -once a year
Recurring payment cancelling
wayforpay_delete_recurrent() - cancels the client’s future automatic payments. Returns "Ok" upon successful execution.

You can also use the "Starting trigger" and "State" blocks (the example uses "Non-state with condition" and Non-state" blocks).
If you don’t want to remove the client from the main chatbot flow, use the "Non-state with condition" block — this block cannot be entered manually, so the client will remain in the main funnel after payment while still receiving a notification of successful payment.
If you need to continue the funnel based on the successful payment, use the "Starting trigger" block. In this case, the client will move from the payment block to the "Starting trigger condition" block, from which you can continue the funnel.
Last updated