> For the complete documentation index, see [llms.txt](https://help.bots.business/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.bots.business/import-and-integrations/coinpayments.md).

# Use an existing CoinPayments integration

Identify the CoinPayments API generation used by the existing library and test a read-only legacy request.

The checked `Libs.CoinPayments` library targets the **legacy** `https://www.coinpayments.net/api.php` form API. CoinPayments also has a newer JSON API with different hosts, credentials and contracts. Choose the documentation for your account's platform before configuring this library. [CoinPayments platform guide](https://docs.coinpayments.net/api/).

## Check credentials without creating a payment

Install `CoinPayments` for a test bot. From an owner-only setup command, configure its legacy public and private keys:

{% code title="Check credentials without creating a payment · Example 1" overflow="wrap" %}

```javascript
Libs.CoinPayments.setPublicKey("YOUR_LEGACY_PUBLIC_KEY");
Libs.CoinPayments.setPrivateKey("YOUR_LEGACY_PRIVATE_KEY");
```

{% endcode %}

Remove literal keys from the command after setup and keep these values out of exported public code. In an owner-only `/coinpayments-check` command:

{% code title="Check credentials without creating a payment · Example 2" overflow="wrap" %}

```javascript
Libs.CoinPayments.apiCall({
  fields: { cmd: "get_basic_info" },
  onSuccess: "/coinpayments-check-result"
});
```

{% endcode %}

In `/coinpayments-check-result`:

{% code title="Check credentials without creating a payment · Example 3" overflow="wrap" %}

```javascript
if (!options || !options.body) { return; }
if (options.body.error !== "ok") {
  Bot.sendMessage("CoinPayments rejected the account check.");
  return;
}
Bot.sendMessage("Legacy CoinPayments credentials are accepted.");
```

{% endcode %}

This method reads account information; it does not create a transaction. The legacy API identifies the operation with `cmd` and returns `error: "ok"` on success. [Legacy account check](https://www.coinpayments.net/apidoc-get-basic-info).

The wrapper uses **`onSuccess`**, unlike OxaPay's `on_success`. The parsed reply is under **`options.body`**. It signs the outgoing form body with HMAC-SHA512. Do not reuse the newer platform's authentication recipe with this wrapper.

## Existing payment flows

The library also exposes `createTransaction`, `getTxInfo`, `createPermanentWallet`, and callback helpers. Its transaction convenience flow constructs a webhook containing a BB API key, and the checked IPN handler is not a complete provider-signature verification boundary. Do not connect a callback directly to valuable balance crediting merely because it reached a bot command.

For an existing deployment, inventory its installed source, API generation, callback URLs and payout permissions. Validate callbacks against the provider's matching authentication rules and recorded transaction state before fulfillment. The newer platform requires a fresh integration; changing the URL in the legacy wrapper is insufficient.

## Errors and migration

The wrapper records API errors and rejects further calls for five minutes after an error. Fix the underlying key, endpoint or request issue instead of repeatedly retrying. A missing result, network failure or an `error` value other than `ok` must not be treated as success.

For new integrations, begin with the provider's current account-specific API documentation and [BJS HTTP](/bjs-reference/http.md), or use the separately documented [OxaPay test flow](/import-and-integrations/oxapay.md). The presence of legacy source is not a promise that your particular legacy account is still supported.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.bots.business/import-and-integrations/coinpayments.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
