1. Go to this page and download the library: Download lipichang/payssion 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/ */
lipichang / payssion example snippets
php
$payssion = new PayssionClient('your api key', 'your secretkey');
//please uncomment the following if you use sandbox api_key
//$payssion = new PayssionClient('your api key', 'your secretkey', false);
$response = null;
try {
$response = $payssion->create(array(
'amount' => 1,
'currency' => 'USD',
'pm_id' => 'alipay_cn',
'order_id' => 'your order id', //your order id
'return_url' => 'your return url' //optional, the return url after payments (for both of paid and non-paid)
));
} catch (Exception $e) {
//handle exception
echo "Exception: " . $e->getMessage();
}
if ($payssion->isSuccess()) {
//handle success
} else {
//handle failed
}
php
//Refunds
$payssion = new PayssionClient('your api key', 'your secretkey');
//please uncomment the following if you use sandbox api_key
//$payssion = new PayssionClient('your api key', 'your secretkey', false);
$response = null;
try {
$payssion->setOrgUrl(true);
//please uncomment the following if you use sandbox
//$payssion->setOrgUrl(false);
$response = $payssion->refunds(array(
'amount' => 1,
'currency' => 'USD',
'transaction_id' => 'your transactoin id',
));
} catch (Exception $e) {
//handle exception
echo "Exception: " . $e->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.