1. Go to this page and download the library: Download paykassa-dev/paykassa 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/ */
ret_keys_and_config = [
"merchant_id" => "Merchant ID",
"merchant_password" => "Merchant Password",
"api_id" => "API ID",
"api_password" => "API Password",
"config" => [
"test_mode" => false,
],
];
/*
* BitCoin: [ BTC ],
* Ethereum: [ ETH ],
* LiteCoin: [ LTC ],
* DogeCoin: [ DOGE ],
* Dash: [ DASH ],
* BitcoinCash: [ BCH ],
* EthereumClassic: [ ETC ],
* Ripple: [ XRP ],
* TRON: [ TRX ],
* Stellar: [ XLM ],
* BinanceCoin: [ BNB ],
* TRON_TRC20: [ USDT ],
* BinanceSmartChain_BEP20: [ USDT, USDC, ADA, EOS, BTC, ETH, DOGE, SHIB ],
* Ethereum_ERC20: [ USDT, USDC, SHIB ],
* Berty: [ USD, RUB ]
*/
$paykassa = new \Paykassa\PaykassaSCI(
$secret_keys_and_config["merchant_id"],
$secret_keys_and_config["merchant_password"],
$secret_keys_and_config["config"]["test_mode"]
);
$private_hash = $_POST["private_hash"];
$res = $paykassa->checkOrderIpn(
$private_hash
);
if ($res['error']) {
echo $res['message'];
// actions in case of an error
} else {
// actions in case of success
$id = $res["data"]["order_id"]; // unique numeric identifier of the payment in your system, example: 150800
$transaction = $res["data"]["transaction"]; // transaction number in the system paykassa: 96401
$hash = $res["data"]["hash"]; // hash, example: bde834a2f48143f733fcc9684e4ae0212b370d015cf6d3f769c9bc695ab078d1
$currency = $res["data"]["currency"]; // the currency of payment, for example: DASH
$system = $res["data"]["system"]; // system, example: Dash
$address = $res["data"]["address"]; // a cryptocurrency wallet address, for example: Xybb9RNvdMx8vq7z24srfr1FQCAFbFGWLg
$tag = $res["data"]["tag"]; // Tag for Ripple and Stellar
$partial = $res["data"]["partial"]; // set up underpayments or overpayments 'yes' to accept, 'no' - do not take
$amount = $res["data"]["amount"]; // invoice amount example: 1.0000000
if ($partial === 'yes') {
// the amount of application may differ from the amount received, if the mode of partial payment
// relevant only for cryptocurrencies, default is 'no'
}
// your code...
echo $id.'|success'; // be sure to confirm the payment has been received
}
ret_keys_and_config = [
"merchant_id" => "Merchant ID",
"merchant_password" => "Merchant Password",
"api_id" => "API ID",
"api_password" => "API Password",
"config" => [
"test_mode" => false,
],
];
/*
* BitCoin: [ BTC ],
* Ethereum: [ ETH ],
* LiteCoin: [ LTC ],
* DogeCoin: [ DOGE ],
* Dash: [ DASH ],
* BitcoinCash: [ BCH ],
* EthereumClassic: [ ETC ],
* Ripple: [ XRP ],
* TRON: [ TRX ],
* Stellar: [ XLM ],
* BinanceCoin: [ BNB ],
* TRON_TRC20: [ USDT ],
* BinanceSmartChain_BEP20: [ USDT, USDC, ADA, EOS, BTC, ETH, DOGE, SHIB ],
* Ethereum_ERC20: [ USDT, USDC, SHIB ],
* Berty: [ USD, RUB ]
*/
$params = [
"merchant_id" => $secret_keys_and_config["merchant_id"],
"wallet" => [
"address" => "TTEAUAzhSFomrv9P7Q5AcqTchWHBq745gh",
"tag" => "",
],
"amount" => "5.123456",
"system" => "TRON_TRC20",
"currency" => "USDT",
"comment" => "My comment",
"priority" => "medium", // low, medium, high
];
$paykassa = new \Paykassa\PaykassaAPI(
$secret_keys_and_config["api_id"],
$secret_keys_and_config["api_password"],
$secret_keys_and_config["config"]["test_mode"]
);
$res = $paykassa->sendMoney(
$params["merchant_id"],
$params["wallet"],
$params["amount"],
$params["system"],
$params["currency"],
$params["comment"],
$params["priority"]
);
if ($res["error"]) { // $res["error"] - true if the error
echo $res["message"]; // $res["message"] - the text of the error message
//actions in case of an error
} else {
//actions in case of success
$merchant_id = $res["data"]["shop_id"]; // merchant id that you originally made payment, example 122
$transaction = $res["data"]["transaction"]; // transaction number of the payment, example 130236
$txid = $res["data"]["txid"]; // txid 70d6dc6841782c6efd8deac4b44d9cc3338fda7af38043dd47d7cbad7e84d5dd can be empty
// In this case, the information about the transaction can be obtained using a universal link from the Explorer_Transaction_Link field, see below
$payment_id = $res["data"]["payment_id"]; // Payment transaction number in the payment system, example 478937139
$amount = $res["data"]["amount"]; // the amount of the payment, how much was written off from the balance of the merchant 0.42
$amount_pay = $res["data"]["amount_pay"]; // the amount of the payment, as it is the user, example: 0.41
$system = $res["data"]["system"]; // the system of payment, which was made the payment, example: Bitcoin
$currency = $res["data"]["currency"]; // the payment currency, for example: BTC
$number = $res["data"]["number"]; // the address where you sent the funds
$commission_percent = $res["data"]["shop_commission_percent"];// the transfer fee percentage, example: 1.5
$commission_amount = $res["data"]["shop_commission_amount"]; // the transfer fee amount, example: 1.00
$paid_commission = $res["data"]["paid_commission"]; // who paid for the Commission, for example: shop
$explorer_address_link =
$res["data"]["explorer_address_link"]; // A link to view information about the address
$explorer_transaction_link =
$res["data"]["explorer_transaction_link"]; // Link to view transaction information
echo sprintf(
'We have sent the %s %s %s to <a target="_blank" href="%s">%s</a>. The txid is <a target="_blank" href="%s">%s</a>',
$system,
$amount,
$currency,
$explorer_address_link,
$number,
$explorer_transaction_link,
$txid
);
}