> For the complete documentation index, see [llms.txt](https://docs.cryptoix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cryptoix.io/developers/sdks-and-libraries.md).

# SDKs and Libraries

Cryptoix provides Software Development Kits (SDKs) and libraries to help developers integrate with our platform seamlessly. These tools abstract away the complexities of direct API calls, offering a more convenient and robust way to interact with the Cryptoix Merchant API.

## Available SDKs

We offer official SDKs for popular programming languages and encourage community-driven libraries.

### Official SDKs

* **PHP SDK:** A comprehensive SDK for PHP developers. It simplifies payment processing, transaction management, and other API operations.
  * **Repository:** <https://github.com/cryptoix/php-sdk>
  * **Documentation:** <https://github.com/cryptoix/php-sdk/blob/main/docs/api-reference.md>

Currently, the PHP SDK is the primary official SDK. We are working on expanding our official SDK offerings for other languages.

### Community Libraries

The Cryptoix community may develop libraries for other languages. Developers can typically find these by searching popular package managers:

* **PHP:** Search on [Packagist](https://packagist.org/) for packages related to "Cryptoix".
* **JavaScript:** Search on [npm](https://www.npmjs.com/) for packages related to "Cryptoix".
* **Python:** Search on [PyPI](https://pypi.org/) for packages related to "Cryptoix".

We encourage community contributions and support for these libraries. For discussions or to share community-developed resources, please visit our developer forum \[Link to Developer Forum - TBD].

## Installation Guides

This section provides instructions for installing and setting up the official Cryptoix SDKs in your projects.

### PHP SDK Installation

To install the Cryptoix PHP SDK using Composer:

```bash
composer require cryptoix/php-sdk
```

After installation, you can instantiate the client in your application.

{% hint style="warning" %}
**Important Security Note:** For production environments, avoid hardcoding your API key directly in your code. Instead, use environment variables or a secure configuration management system to store and retrieve your API key.
{% endhint %}

```php
<?php
require 'vendor/autoload.php';

use Cryptoix\Sdk\Client;

// Replace with your actual API key. Consider using environment variables.
$apiKey = getenv('CRYPTOIX_API_KEY') ?: 'YOUR_API_KEY';
$client = new Client($apiKey);

// Now you can use the client to interact with the API
// e.g., $balance = $client->account->getBalance();
?>
```

## Usage Examples

Here are some common API interactions using the SDKs. Ensure you have replaced placeholders like `YOUR_API_KEY` and relevant IDs with your actual credentials and data.

### Creating a Payment Link (PHP SDK)

```php
<?php
require 'vendor/autoload.php';

use Cryptoix\Sdk\Client;
use Cryptoix\Sdk\Exceptions\ApiException;

// Replace with your actual API key. Consider using environment variables.
$apiKey = getenv('CRYPTOIX_API_KEY') ?: 'YOUR_API_KEY';
$client = new Client($apiKey);

$paymentData = [
    'amount' => '100.50',
    'currency' => 'USD',
    'description' => 'Example Product Purchase',
    'callback_url' => 'https://your-site.com/payment/callback',
    'redirect_url' => 'https://your-site.com/payment/success',
];

try {
    $paymentLink = $client->payments->createLink($paymentData);
    // The response structure might vary; adjust based on actual API response.
    echo "Payment Link Created: " . $paymentLink['url'];
} catch (ApiException $e) {
    // Log the error or handle it appropriately.
    error_log("Error creating payment link: " . $e->getMessage());
    echo "Error creating payment link. Please try again later.";
}
?>
```

### Retrieving Transaction History (PHP SDK Example)

To demonstrate another common operation using the PHP SDK:

```php
<?php
require 'vendor/autoload.php';

use Cryptoix\Sdk\Client;
use Cryptoix\Sdk\Exceptions\ApiException;

// Replace with your actual API key. Consider using environment variables.
$apiKey = getenv('CRYPTOIX_API_KEY') ?: 'YOUR_API_KEY';
$client = new Client($apiKey);

try {
    // Parameters like 'limit' and 'offset' are for pagination.
    $transactions = $client->transactions->list(['limit' => 10, 'offset' => 0]);
    echo "Transaction History:\n";
    // The structure of $transactions depends on the API response.
    print_r($transactions);
} catch (ApiException $e) {
    error_log("Error fetching transactions: " . $e->getMessage());
    echo "Error fetching transactions. Please try again later.";
}
?>
```

### Checking Account Balance (PHP SDK Example)

```php
<?php
require 'vendor/autoload.php';

use Cryptoix\Sdk\Client;
use Cryptoix\Sdk\Exceptions\ApiException;

// Replace with your actual API key. Consider using environment variables.
$apiKey = getenv('CRYPTOIX_API_KEY') ?: 'YOUR_API_KEY';
$client = new Client($apiKey);

try {
    $balance = $client->account->getBalance();
    // The response structure might vary; adjust based on actual API response.
    echo "Current Balance: " . $balance['amount'] . " " . $balance['currency'];
} catch (ApiException $e) {
    error_log("Error fetching balance: " . $e->getMessage());
    echo "Error fetching balance. Please try again later.";
}
?>
```

## Contributing to SDKs

We welcome contributions to our official SDKs from the developer community. Your efforts help improve the SDKs for everyone.

### How to Contribute

1. **Fork the Repository:** Navigate to the SDK's repository on GitHub: <https://github.com/cryptoix/php-sdk>. Fork the repository to your GitHub account.
2. **Create a Branch:** Create a new branch for your feature or bug fix (e.g., `feature/new-payment-method` or `fix/api-bug`).
3. **Make Changes:** Implement your changes, adhering to the project's coding standards and best practices.
4. **Write Tests:** Ensure your changes are covered by new or updated unit tests. Run the test suite to verify your changes.
5. **Submit a Pull Request:** Open a pull request from your forked repository's branch to the main `main` branch of the official repository. Clearly describe your changes, the problem they solve, and any relevant context.
6. **Code Review:** Our team will review your contribution and provide feedback. We aim to respond promptly.

### Contribution Guidelines

* **Coding Standards:** Please follow the existing style and conventions of the SDK. Refer to the `CONTRIBUTING.md` file in the repository for detailed guidelines.
* **Testing:** All contributions, especially new features or bug fixes, should include comprehensive unit tests. Ensure the existing test suite passes.
* **Documentation:** Update or add relevant documentation for your changes, particularly for new methods or significant modifications.
* **Issue Tracker:** Before starting significant work, please check the issue tracker on GitHub for existing issues or open a new one to discuss your proposed changes. This helps avoid duplicated effort and ensures alignment.

For any questions regarding SDKs or contributions, please reach out to our developer support team via \[Link to Developer Support Channel - TBD] or open an issue on the respective GitHub repository.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cryptoix.io/developers/sdks-and-libraries.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
