Files
einundzwanzig-portal/app/Http/Livewire/Test/WebLN.php
fsociety cf15c22116 feat(payment): add WebLN payment functionality
Implemented functionality to create an invoice and make payment using WebLN. Also added error handling and logging for payment process. Updated UI to display payment information and a button to initiate payment.
2024-09-10 21:15:21 +02:00

43 lines
853 B
PHP

<?php
namespace App\Http\Livewire\Test;
use App\Traits\LNBitsTrait;
use Illuminate\Support\Facades\Log;
use Livewire\Component;
class WebLN extends Component
{
use LNBitsTrait;
public $invoice;
public function mount()
{
$this->invoice = $this->createInvoice(
sats: 1,
memo: 'Test Payment from WebLN',
lnbits: [
'read_key' => '97f6120563e3498b8be4c67023c912ae',
'url' => 'https://bits.codingarena.top',
]
);
}
public function reloadMe()
{
// full reload current page
return redirect()->route('webln');
}
public function logThis($text)
{
Log::info('WEBLN: ' . $text);
}
public function render()
{
return view('livewire.test.web-l-n')->layout('layouts.test');
}
}