24 lines
635 B
PHP
24 lines
635 B
PHP
<?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;
|
|
}
|
|
}
|