Access Variables between functions in Laravel class

refer my code snippet, i am in requisite to access the amount variable set in cartcheckout through cartcallback. but it is generating unable to access the same.


class ObjController extends Controllers
{
    public function cartcheckout(Request $request)
    {
        ...

        $totamount = $data->Amount;
     
        ...

        return redirect($payurl);
    }

    public function cartcallback(Request $request)
    {
        // Need the totamount value here
    }
}