PHPackages                             xentixar/khalti-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. xentixar/khalti-sdk

ActiveLibrary[Payment Processing](/categories/payments)

xentixar/khalti-sdk
===================

v1.0.0(1y ago)149MITPHP

Since Jun 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/xentixar/khalti-sdk)[ Packagist](https://packagist.org/packages/xentixar/khalti-sdk)[ RSS](/packages/xentixar-khalti-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

KhaltiSdk PHP Library
=====================

[](#khaltisdk-php-library)

The `KhaltiSdk` is a PHP library for integrating the Khalti payment gateway into your application. This library simplifies the process of initializing payments, validating transactions, and more.

Installation
------------

[](#installation)

To use this library, you'll need to include it in your project. You can install it via Composer. If you don't have Composer installed, you can download it from [getcomposer.org](https://getcomposer.org/).

### Step-by-step Installation

[](#step-by-step-installation)

1. **Install Composer**:

    ```
    curl -sS https://getcomposer.org/installer | php
    mv composer.phar /usr/local/bin/composer
    ```
2. **Add the package to your project**:

    ```
    composer require xentixar/khalti-sdk
    ```
3. **Include Composer's autoloader** in your script:

    ```
    require_once __DIR__ . '/vendor/autoload.php';
    ```

Usage
-----

[](#usage)

### Setting Up the Khalti Instance

[](#setting-up-the-khalti-instance)

Create a new instance of the `Khalti` class and set your secret key using the `setSecretKey` method. The secret key is required for authorization when making API requests.

### Example Code

[](#example-code)

```
