How do I use getCurrentCart from API?

Just wondering how to store certain things from the getCurrentCart and how to use it:
https://www.wix.com/velo/reference/wix-stores-backend/getcurrentcart

  1. Store _id from cart

  2. Store “totals” , “total” value.

  3. Store “lineItems” (everything if possible) (optional)

  4. Delete everything from the cart?
    Honestly not sure how to code this at all so any help would be appreciated!
    My goal is to store the cart_id, store total from the cart, and delete everything from the cart in that order by pressing a button.
    (My guess is to make a new variable for cart _id and totals and before I delete everything from cart, I store it in a database)
    Any help or tips would be appreciated!