1. Go to this page and download the library: Download mu-hasan/laravel-winpay 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/ */
winpay()->getToolbar();
// OR
Winpay::getToolbar();
winpay()->getPaymentCode($paymentChannel, $transaction, $user, $items);
// OR
Winpay::getToolbar($paymentChannel, $transaction, $user, $items);
class FooTransaction extends Model implements BillingTransaction
{
//...
public function getBillTransactionEndAt(): \DateTime
{
return $this->reff;
}
public function getBillTransactionReff(): string
{
return $this->reff;
}
public function getBillTransactionAmount(): int
{
return $this->total;
}
//...
}
class FooUser extends Model implements BillingUser
{
//...
public function getBillUserName(): string
{
return $this->name;
}
public function getBillUserPhone(): string
{
return $this->phone;
}
// nullable
public function getBillUserEmail(): ?string
{
return $this->email;
// OR
// return null;
}
//...
}
class FooItem extends Model implements BillingItem
{
//...
public function getBillItemName(): string
{
return $this->name;
}
public function getBillItemQty(): int
{
return $this->qty;
}
public function getBillItemUnitPrice(): int
{
return $this->amount;
}
// nullable
public function getBillItemSku(): ?string
{
return $this->short_id;
// OR
// return null;
}
// nullable
public function getBillItemDesc(): ?string
{
return $this->note;
// OR
// return null;
}
//...
}