# Stripe

* [How to connect ](#how-to-connect)
* [How to get a link to payment ](#how-to-get-a-link-to-payment)
* [How to process the result ](#how-to-process-the-result)
* [How to test payments](#how-to-test-payments)

## How to connect&#x20;

To connect the Stripe payment system you need a secret API and a webhook key.&#x20;

You can copy the secret API key to the Developers -> API key partition and copy the Secret key.

<img src="/files/JbyzFpQdOLmZ96oYH80q" alt="" width="563">

Next you need to set the URL for the Callbacks. This is necessary for the bot to receive payment notifications.&#x20;

Go to the Webhooks section and add an address for webhooks.

<img src="/files/w73i2MVF26BmEKjF5Lsq" alt="" width="563">

set the URL: <https://chatter.salebot.pro/stripe_callback/result>

and select the event:

`checkout.session.completed`

<img src="/files/hVtxuXyaExGDEmmx7XUt" alt="" width="411">

Save and get to the page with the installed webhook, copy the key (Signing secret) webhook (in the salebot field - Webhook key):

\
after pressing Reveal key will open Webhook, which will start with whsec\_...&#x20;

<img src="/files/5lfMQlhZIF17MQvgYjcN" alt="" width="563">

After receiving the keys, we will proceed to the settings in Salebot.&#x20;

In salebot, open the section of payment systems, select Stripe. On the connection page, you need to enter the received data.

&#x20;                                        ![](/files/MglZL3C7co9C7dfV4www)

![](/files/2dnsc5HWlOReA7JLM86w)

## How to get a link to payment&#x20;

To generate a link to a payment, you need to set the value of the payment\_sum variable (such as 150 or 100.55 (via a dot!)), then the stripe\_pay\_url variable appears. This variable can be displayed with a link or placed on the button with the text "Pay".&#x20;

The link has the form:

`https://checkout.stripe.com/pay/cs_test_a17mskKFFRwEuo3WgBSAUjfk7xaZZIrct9B3Ds2AdODVq1I8aRiqYEBdrU#fidkdWxOYHwnPyd1blpxYHZxWjA0TGFsVzFPVmpmMzJAbVYzUkp1Y0lLYDVgfzR2Q0NxcWZBNUNnTnRSVVRJSGFobEB1UExSczRMMTc8PWRLMGBddl8xalxyPDRoUGhnZm9xXXZANDZyaF0wNTVBVExsPHZyfycpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl`

{% hint style="warning" %}
The default set is USD (dollar), if you need another currency you need to set the value of the variable currency
{% endhint %}

Also, before setting the payment\_sum value, you can specify the following optional variables to configure the payment.&#x20;

currency - order currency. Valid values - [https://stripe.com/docs/currencies ](<https://stripe.com/docs/currencies >)

payment\_description - order description

### Example of a link to pay&#x20;

Create a link to a payment of EUR 2 (default dollar)

&#x20;                                                ![](/files/fVlFyoulq08debJgFtWc)

{% hint style="info" %}
Please note:

* First specify optional parameters first\_name, payment\_description, etc.
* And last, assign the value of the payment\_sum variable
  {% endhint %}

Note, first we set additional variables for the settings, then payment\_sum. You can define variables earlier in a chain, not in a single block, this is an example.

Next, at the right place, we will display the stripe\_pay\_url variable, which contains the link in the block or in the button

&#x20;                                     &#x20;

![](/files/O1Ix7xltV4N68UMOCMNF)

Payment example page

&#x20;     &#x20;

![](/files/BYaIGW8dfi0mgrSWT8qF)

## How to process the result&#x20;

After successful payment in the bot will come callbacks, on which you can understand that there was a successful payment. These callbacks in the system you see as messages from the user, so that they can not be sent by the user, they consist of the first 20 characters of the secret key and the account success, for example: sk\_live\_d35gky6d8ers\_success&#x20;

These callbacks DO NOT SEE the user, they are displayed only to the operator.&#x20;

The type of comparison should be "Full match"&#x20;

Also after successful payment, the stripe\_payment\_completed variable is set to True.&#x20;

For example, you can make a successful payment processing block with a condition and print the corresponding message to the user:

![](/files/BaemYDI3zwy4UTUEcscK)

After the payment is completed, a stripe\_callback\_data variable will be added to the client, containing the payment system response data for the completed transaction. You can extract the necessary data from the dictionary using the get method.

{% hint style="warning" %}
To make a repeat payment, you must reset the payment\_sum, the previously generated link, and after you reset the payment\_sum variable to get a new link. You can specify a previous value.
{% endhint %}

## How to test payments&#x20;

You can use the secret key from the test environment to test the integration. To do this, in the personal account stripe menu on the right, you need to switch to the test environment.

![](/files/91H5GQ02lNo2DZmBIk74)

Next, configure the configuration described at the beginning of this instruction. Enter the test secret key and add the address for webhooks to the test environment.

Test card number&#x20;

4242 4242 4242 4242&#x20;

any future date&#x20;

CVC - any three digits&#x20;

If something is not working, compare the data with the data on the official site: https\:/stripe.com/docs/testing#regulatory-cards


---

# 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/integrations/payment/stripe.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.
