# Wayforpay

{% hint style="info" %}

* 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
  {% endhint %}

### **How to connect**

To connect the wayforpay payment system, you will need 3 values:

1. merchant's login
2. merchant's secret key
3. the domain name of the merchant's website.

Go to your personal account -> store settings **<https://m.wayforpay.com/mportal/merchant/list>**

<figure><img src="/files/7L08FeUKwO1jZKr9o6K4" alt="" width="563"><figcaption></figcaption></figure>

Copy the data and go to the settings in Mavibot.

Open the "Acquiring" section, select wayforpay.

<figure><img src="/files/UwXENiaosLbTuyJJ6mHG" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/s4CJIuor5U1SBHFSihdf" alt=""><figcaption></figcaption></figure>

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):

<figure><img src="/files/CA3UfA3fvSsunXcW0Xrg" alt=""><figcaption></figcaption></figure>

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:

<figure><img src="/files/e670XHdt6oAhpKIaLzVX" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/077rYr1YDWAdh9xhj2Io" alt=""><figcaption></figcaption></figure>

The link looks like:

<https://secure.wayforpay.com/invoice/id1bbb2ad0375>

{% hint style="warning" %}
By default, <mark style="color:red;">USD (dollars)</mark> is set, if you need another currency, you need to set the value of the currency variable.
{% endhint %}

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.

<img src="https://lh6.googleusercontent.com/Qsm1KH-AI7U8pv_6AjddIF3rWTlidd-TCKepv0LtbxbpEHBL72YbrQ-Yzb-UvI64-ih_XVqb9kjVCRcix6B5rWFK-AWgNLEbHgsaLCZvMHXoH7xHmSrnsZz-qKB0wHH67M0u8gyR" alt="Example of creating a payment link" width="375">

Let's create a link for payment in the amount of 1 <mark style="color:red;">USD</mark> and a lifetime of 2 hours:

<figure><img src="/files/CVHddwnwyk0UYe5zRnLx" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Pay attention:** \
\- First, specify the optional parameters  **product\_name** ad etc.\
\- And the last, assign the value of the **payment\_sum** variable.
{% endhint %}

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):

<figure><img src="/files/q2qAahmWucnXYzv30yHp" alt=""><figcaption></figcaption></figure>

The bot will work as follows:

<figure><img src="/files/EbFnsmeGmpMRWpQR9t1N" alt="" width="563"><figcaption></figcaption></figure>

### 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**

<figure><img src="/files/3Y9MKTRpBh42Qs2qkUJr" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
These callbacks are NOT VISIBLE to the user, they are displayed only to the operator.
{% endhint %}

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:

<figure><img src="/files/MI2JQsTQa6t9ewyXJbyH" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/b4mJABaVJfutZH5Q5r9Z" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
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.
{% endhint %}

{% hint style="success" %}
More information about conditional blocks is provided in the article of the same name
{% endhint %}

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.&#x20;

<table><thead><tr><th width="303.85546875">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>amount</td><td>payment amount</td></tr><tr><td>currency</td><td>currency. Default: UAH (possible values: USD, EUR, RUB). Optional parameter.</td></tr><tr><td>session_timeout</td><td>link lifetime in seconds. Default: 3600 (1 hour). Optional parameter.</td></tr><tr><td>product_name</td><td>product name. Optional parameter.</td></tr><tr><td>language</td><td>payment page language. Default: UA (possible values: RU, EN). Optional parameter.</td></tr><tr><td>buyer_name</td><td>customer name. Optional name.</td></tr><tr><td>buyer_email</td><td>Customer email. Optional parameter.</td></tr><tr><td>regular_date_next</td><td>next automated transaction date. Default: one month after the link is created. Optional parameter.</td></tr><tr><td>regular_date_end</td><td>automated transaction end date. Default: one year after the link is created. Can be omitted if the regular_count parameter is specified. Optional parameter.</td></tr><tr><td>regular_count</td><td>number of automated transaction. If specified, the regular_date_end parameter will be ignored. Optional parameter.</td></tr><tr><td>regular_mode</td><td>recurring payment interval. Optional parameter. Possible values: <br>- once - one-time payment<br>- daily - daily<br>- weekly - weekly<br>- quarterly - every 3 months after the first payment date<br>- monthly - once a month<br>- bimonthly - once every 2 months<br>- halfyearly - рonce every 6 months<br>- yearly  -once a year</td></tr></tbody></table>

### Recurring payment cancelling

wayforpay\_delete\_recurrent() - cancels the client’s future automatic payments. Returns "Ok" upon successful execution.

<figure><img src="/files/39oaPOWmz7tEQp29SSSy" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
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.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mavibot.ai/payment/wayforpay.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
