*/ public function retrieve(string $subscriptionId): array { $response = $this->client->get("/subscriptions/{$subscriptionId}"); return Arr::get($response, 'data', is_array($response) ? $response : []); } /** * @param array $subscription * @return array */ public function customData(array $subscription): array { $attributes = Arr::get($subscription, 'attributes', []); $custom = Arr::get($attributes, 'custom_data', Arr::get($attributes, 'custom', [])); return is_array($custom) ? $custom : []; } public function portalUrl(array $subscription): ?string { return Arr::get($subscription, 'attributes.urls.customer_portal') ?? Arr::get($subscription, 'attributes.urls.customer_portal_url'); } public function updatePaymentMethodUrl(array $subscription): ?string { return Arr::get($subscription, 'attributes.urls.update_payment_method') ?? Arr::get($subscription, 'attributes.urls.update_payment_method_url'); } }