feat(payment): implement beautiful payment confirmation page with real-time status checking
- Add PaymentSuccessController with authentication and subscription selection logic - Create PaymentConfirmation Livewire component with polling mechanism - Implement real-time subscription status verification via Polar provider API - Add confetti animation for successful payment confirmation - Design responsive payment success page with dark mode support - Fix Polar provider field mapping (updated_at -> modified_at) - Add comprehensive error handling and logging - Support multiple subscription status states (verifying, activated, pending, error) - Implement automatic polling with 30-second intervals (max 5 attempts) - Add fallback redirects and user-friendly status messages
This commit is contained in:
@@ -461,10 +461,19 @@ class PolarProvider implements PaymentProviderContract
|
||||
|
||||
if (! $response->successful()) {
|
||||
Log::error('Failed to retrieve Polar subscription: '.$response->body());
|
||||
throw new \Exception('Polar subscription not found: '.$response->status());
|
||||
}
|
||||
|
||||
$polarSubscription = $response->json();
|
||||
|
||||
if (! $polarSubscription || ! isset($polarSubscription['id'])) {
|
||||
Log::error('Invalid Polar subscription response', [
|
||||
'subscription_id' => $providerSubscriptionId,
|
||||
'response' => $polarSubscription,
|
||||
]);
|
||||
throw new \Exception('Invalid Polar subscription response');
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $polarSubscription['id'],
|
||||
'status' => $polarSubscription['status'],
|
||||
@@ -476,7 +485,7 @@ class PolarProvider implements PaymentProviderContract
|
||||
'trial_start' => $polarSubscription['trial_start'] ?? null,
|
||||
'trial_end' => $polarSubscription['trial_end'] ?? null,
|
||||
'created_at' => $polarSubscription['created_at'],
|
||||
'updated_at' => $polarSubscription['updated_at'],
|
||||
'updated_at' => $polarSubscription['modified_at'] ?? null,
|
||||
];
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
Reference in New Issue
Block a user