attributes->get('fastapi_openid'); if ($openid === null) { Gate::authorize('pay', $booking); } $payment = $this->initiatePaymentAction->handle($booking); if ($payment->status === PaymentStatus::Failed) { return response()->json([ 'message' => 'Payment initiation failed', 'errors' => [ 'payment' => ['Payment initiation failed'], ], ], 422); } return (new PaymentResource($payment)) ->response() ->setStatusCode(201); } }