Initialer Laravel Commit für BetiX
This commit is contained in:
27
app/Http/Controllers/NowPaymentsWebhookController.php
Normal file
27
app/Http/Controllers/NowPaymentsWebhookController.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\DepositService;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class NowPaymentsWebhookController extends Controller
|
||||
{
|
||||
public function __construct(private readonly DepositService $deposits)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /api/webhooks/nowpayments — public IPN endpoint
|
||||
* - CSRF should be disabled via api middleware group
|
||||
* - Validates HMAC signature and processes deposit crediting
|
||||
*/
|
||||
public function __invoke(Request $request)
|
||||
{
|
||||
$out = $this->deposits->handleIpn($request);
|
||||
return response()->json([
|
||||
'ok' => (bool) ($out['ok'] ?? false),
|
||||
'message' => $out['message'] ?? 'ok',
|
||||
], (int) ($out['status'] ?? 200));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user