switched to paddle inline checkout, removed paypal and most of stripe. added product sync between app and paddle.
This commit is contained in:
33
app/Services/Paddle/PaddleSubscriptionService.php
Normal file
33
app/Services/Paddle/PaddleSubscriptionService.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Paddle;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class PaddleSubscriptionService
|
||||
{
|
||||
public function __construct(private readonly PaddleClient $client) {}
|
||||
|
||||
/**
|
||||
* Retrieve a subscription record directly from Paddle.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function retrieve(string $subscriptionId): array
|
||||
{
|
||||
$response = $this->client->get("/subscriptions/{$subscriptionId}");
|
||||
|
||||
return is_array($response) ? $response : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience helper to extract metadata from the subscription response.
|
||||
*
|
||||
* @param array<string, mixed> $subscription
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function metadata(array $subscription): array
|
||||
{
|
||||
return Arr::get($subscription, 'data.metadata', []);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user