Paypal
Setting up the Paypal Chat Payment Reception
Last updated
Setting up the Paypal Chat Payment Reception
Last updated
To work with paypal, you need to get two keys: client_id and secret
Go to the page https://developer.paypal.com/developer/applications/
And choose from the list or create a new application:
At the top, change the switch to Live mode and select the application you want. Opens a page with the settings where you can find the data you want:
Copy data and paste it into the corresponding fields in the Salebot - Payment Systems - Paypal settings:
That’s the end of the connection.
To generate a paylink, you need to set the payment_sum variable value and the paypal_pay_url variable appears immediately.
payment_title is not a mandatory variable, it is the name of the product. If you do not specify is filled with the text: "Payment account order_id" (order_id - order identifier in the server)
payment_description - product description, optional
In addition, before you specify payment_sum, you can specify in which language the payment page will be. To do this, you need to set the variable locale, the default is Russian (ru-RU). All possible options: da-DK, he-IL, id-ID, ja-JP, no-NO, pt-BR, ru-RU, sv-SE, th-TH, zh-CN, zh-HK, zh-TW.
And the third additional parameter is company_name - the name of your company, displayed at the very top of the page (example below, company).
You can also specify the currency in which the payment is accepted, for this we specify the variable currency, the default is set ruble (RUB), for the dollar set its value USD (currency = USD). Possible currency variants can be found under the link https://developer.paypal.com/docs/api/reference/currency-codes/
And the third additional parameter is company_name - the name of your company, displayed at the very top of the page (example below, company )
The paypal_pay_url variable can be displayed with a link or placed on the "Pay" button.
The link has the form: https://ww.paypal.com/checkoutnow?token=07N53571YM296381N
Example implementation.
Set payment amount 444 and company name
Note: the payment_sum variable is set to the last variable, after the optional payment_title, company_name, etc.
After successful payment in the bot will come kolbeks, by which you can understand that there was a successful payment. These colbecks 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 10 secret symbols and a homepage with status, for example: EHsWHYOoWV_success.
Also, after successful payment, the paypal_payment_completed variable is set to True.
These callbacks ARE NOT SEEN to the user, they are displayed only to the operator.
The type of comparison should be "Full match"
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.
The callbacks arrive with a delay, so after the link to the user’s payment, we recommend sending a message that goes like, "After payment, wait for the message about successful payment completion"
For example, you can make a successful payment processing block with a condition and print the corresponding message to the user:
The type of comparison should be "Full match"
Upon completion of payment, the paypal_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.