# QiwiPayments

## Getting started

{% hint style="warning" %}
Need Api token from <https://qiwi.com/api>
{% endhint %}

### Set Api Token to lib:

`Libs.QiwiPayment.setQiwiApiToken(API_KEY);`

### Get payment link

```javascript
let link = Libs.QiwiPayment.getPaymentLink({
    account: "+7XXXXXXXXXX", // Qiwi wallet
    amount: 250, // amount in RUB
    comment: "u" + String(user.id) // track transaction with label for user or order 
});
```

User can make payment via this link.

### Bot need check payments

```javascript
Libs.QiwiPayment.acceptPayment({
      account: "+7XXXXXXXXXX", // Qiwi wallet
      onSuccess: "/onacceptpayment",
      onNoPaymentYet: "/onnopaymentyet",
      comment: "u" + user.id // track transaction with label for user or order
})
```

If payment recived command `/onacceptpayment` executed.

Params contain amount in RUB:

`let amount = parseFloat(params);`


---

# 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://help.bots.business/libs/qiwipayments.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.
