PHP code example of stitchua / yii2-tpay
1. Go to this page and download the library: Download stitchua/yii2-tpay 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/ */
stitchua / yii2-tpay example snippets
'tpay' => [
'class' => 'stitchua\\tpay\\Tpay',
'merchantId' => 77700,
'merchantCode' => 'AT6oNO0F5ntQQQXxX',
'validateServerIP' => false
],
$tpayModule = Yii::$app->getModule('tpay');
$basicPayload = new TpayBasicPayloadCommercialSale($this);
$basicPayload->setExpirationDate(DateHelper::now()->addMinutes(2)->format('Y:m:d:H:i'));
$basicPayload->setReturnUrl(Yii::$app->urlManager->createAbsoluteUrl(['/mobile/payment/paymentlandingpage', 'result' => 'success']));
$basicPayload->setReturnErrorUrl(Yii::$app->urlManager->createAbsoluteUrl(['/site/paymentlandingpage', 'result' => 'error']));
/** @var TpayNoApiPayload $payload */
$payload = null;
$link = (new IntegrationWithoutAPI($tpayModule))->getPaymentLink($basicPayload, $payload);
if(!empty($link)){
$this->updateAttributes([
'fld_payment_crc' => $payload->crc,
'fld_status' => self::STATUS_IN_PAYMENT,
]);
}
// Tutaj link już jest wygenerowany
return $link;
class TpayBasicPayloadCommercialSale extends \yii\base\Model implements \stitchua\tpay\base\ILinkPayload
{
}
php yii migrate --migrationPath="@stitchua/tpay/migrations"
php yii migrate --migrationPath="@stitchua/tpay/migrations"