Stripe

How to connect

To connect the Stripe payment system you need a secret API and a webhook key.

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

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

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

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

and select the event:

checkout.session.completed

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_...

After receiving the keys, we will proceed to the settings in Salebot.

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

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".

The link has the form:

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

The default set is USD (dollar), if you need another currency you need to set the value of the variable currency

Also, before setting the payment_sum value, you can specify the following optional variables to configure the payment.

currency - order currency. Valid values - https://stripe.com/docs/currencies

payment_description - order description

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

Please note:

  • First specify optional parameters first_name, payment_description, etc.

  • And last, assign the value of the payment_sum variable

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

Payment example page

How to process the result

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

These callbacks DO NOT SEE the user, they are displayed only to the operator.

The type of comparison should be "Full match"

Also after successful payment, the stripe_payment_completed variable is set to True.

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

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.

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.

How to test payments

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.

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

4242 4242 4242 4242

any future date

CVC - any three digits

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

Last updated