1. Go to this page and download the library: Download snlbaral/khalti-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
snlbaral / khalti-api example snippets
use Snlbaral\Khalti\Khalti;
$khalti = new Khalti();
/**
*
* @param string $secret your khalti merchant secret key
* @param string $token your khalti api payment transaction token
* @param string $idx your khalti api payment transaction idx
* @param int $amount khalti payment transaction amount
*/
//Payment Verification
$response = $khalti->verifyPayment($secret,$token,$amount);
//List Transactions
$response = $khalti->listTransactions($secret);
//Get Transaction
$response = $khalti->getTransaction($secret,$idx);
//Transaction Status
$response = $khalti->transactionStatus($secret,$token,$amount);