Coinpayments
Как подключить ссылка How to connect
Как сформировать ссылку на оплату ссылка How to generate a payment link
Как обработать результат ссылка How to process the result
Как проверить статус платежа ссылка How to check the payment status
How to connect
To connect the Coinpayments payment system, you will need four values: the seller ID, the IPN secret (for webhooks), the API private key, and the API public key. You will also need to set the webhook URL.
Go to the personal account of Coinpayments -> Account settings https://www.coinpayments.net/index.php?cmd=acct_settings
On the first tab, copy the seller's ID. (seller ID)

Next, go to the "Seller Settings" tab and create and enter an IPN secret key - IPN secret ( This is used to verify that the webhook is coming from us). Use a secure, complex string that is hard to guess
IPN link - is the URL for webhooks, add the following: https://chatter.salebot.pro/coinpayments_callback/result
Next, go to the API Keys section and generate a key pair to access the API.
Save all the settings, copy the data and go to the settings in Mavibot. Open the "Acquiring" section, select Coinpayments.

You need to enter the received data.

To generate a payment link, you need to set the value of the required variables:
original_currency
The original currency of the transaction.
sending_currency
The currency that the customer will send.
For example, if your products are priced in USD, but you receive BTC, you should use original_currency = USD and sending_currency = BTC. original_currency and sending_currency can have one value if currency conversion is not required.
buyer_email
Customer's email address.
To send notifications if the payment is for a lower amount and needs to be paid extra, or for refunds. If this variable is not set, the mail will be taken automatically from the email variable, if the user has one in Mavibot.
After that, you need to set the value of the payment_sum variable (for example, 10 or 0.0055 (separated by a dot!)), and the coinpayments_pay_url variable will appear immediately after that. This variable can be displayed with a link or placed on a button with the text "Pay". The link looks like: https://www.coinpayments.net/index.php?cmd=checkout&id=CPFK5QZ3FKSNWHI75CO8M4BRVD&key=e7782d2ce24f7d03815606a5c4a882eb
Also, before setting the value of the payment_sum variable, you can set the following optional variables to configure the payment.
payment_description - the product name will be on the payment information page and in the IPN for the transaction.
buyer_name - customer's name
This is what the payment page looks like.
How to generate a payment link
Create a payment link in the amount of 0.0256

Pay attention: - First, specify the email address -Next optional parameters first_name, payment_description and ect. - Finally, assign a value to 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, we output the coinpayments_pay_url variable in the right place, which contains the link

To make a repeat payment, you need to reset the payment_sum, the previously generated link, and then reassign the payment_sum variable to get a fresh link.
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. To prevent the user from sending them, they consist of the first 10 characters of the secret key and the postscript _success, for example: 16831CF4b5_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 coinpayments_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:

After the payment is completed, the coinpayments_payment_callback variable will be added to the client, containing the data of the payment system's response to the completed transaction. You can extract the required data from the resulting dictionary using the get method.
How to check the payment status
To check the payment status, use coinpayments_get_payment_status() method in the Calculator field.
Example:

Status example:
Waiting for buyer funds...
Funds received and confirmed sending to you shortly…
Complete
Last updated