-
app/Mail/Forms/SubmissionConfirmationMail.php
Open in GitHubuse Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; class FailedPaymentNotification extends Notification implements ShouldQueue { use Queueable; public function via($notifiable) { return ['mail']; } public function toMail($notifiable) { return (new MailMessage) ->subject('Your Payment Failed') ->greeting(__('We tried to charge your card for your OpenForm subscription but the payment but did not work.')) ->line(__('Please go to OpenForm, click on your name on the top right corner, and click on "Billing". You will then be able to update your card details. To avoid any service disruption, you can reply to this email whenever you updated your card details, and we\'ll manually attempt to charge your card.')) ->action(__('Go to OpenForm'), url('/')); } }
-
app/Http/Controllers/Webhook/StripeController.php
Open in GitHubuse App\Notifications\Subscription\FailedPaymentNotification; use Laravel\Cashier\Http\Controllers\WebhookController; class StripeController extends WebhookController { // protected function handleChargeFailed(array $payload) { if ($user = $this->getUserByStripeId($payload['data']['object']['customer'])) { $user->notify(new FailedPaymentNotification()); } return $this->successMethod(); } // }