I am developing with laravel vue. I have to make an api call where i need to use a response from the call to make another api call after adding another parameter to it. Basically this is it. If i make the payment initialization call, this will be returned as a sample response
Now to validate the charge, i have to pass the flw_ref in addition the the otp supplied by the user to make another call to the validate endpoint. How do i save the flw_ref to make the next call. Right now i am thinking of cache or session. I am using laravel http client(https://laravel.com/docs/7.x/http-client) for the calls.
If the call is made at the same time you can of course just save it to a variable. The response is in JSON format which you can decode to a php array with json_decode or when using the laravel http client
Http::get('http://test.com')->json()
If you need it later on and not in the same request try if session is enough since it will be deleted when the user leaves the page. Then imo your best choice is to save it to the db, if the values aren't a security issue.