paddel setup
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Payments;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
final class PaddleClient
|
||||
{
|
||||
public function customer(?string $customerID): ?array
|
||||
{
|
||||
if (!$customerID || !config('rsync-studio.paddle.api_key')) return null;
|
||||
|
||||
$response = Http::baseUrl(config('rsync-studio.paddle.api_url'))
|
||||
->withToken(config('rsync-studio.paddle.api_key'))
|
||||
->acceptJson()
|
||||
->timeout(10)
|
||||
->get('/customers/'.$customerID);
|
||||
|
||||
if (!$response->successful()) return null;
|
||||
$data = $response->json('data');
|
||||
return is_array($data) ? $data : null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user