lnbits paid articles added

This commit is contained in:
HolgerHatGarKeineNode
2023-03-13 16:35:20 +01:00
parent 9f51c71439
commit 639e17080c
30 changed files with 838 additions and 60 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Traits;
use Illuminate\Support\Facades\Http;
trait LNBitsTrait
{
public function createInvoice($sats, $memo)
{
$lnbits = auth()->user()->lnbits;
$response = Http::withHeaders([
'X-Api-Key' => $lnbits['read_key'],
])
->post($lnbits['url'].'/api/v1/payments', [
'out' => false,
'amount' => $sats,
'memo' => $memo,
]);
return $response->json();
}
public function check($paymentHash)
{
$lnbits = auth()->user()->lnbits;
$response = Http::withHeaders([
'X-Api-Key' => $lnbits['read_key'],
])
->get($lnbits['url'].'/api/v1/payments/' . $paymentHash);
return $response->json();
}
}