How do ads work inside quick-commerce apps?

Brands pay for higher placement in search results and category shelves, usually per click or per view. The ad only shows when the product is in stock in the local store serving the shopper, so ad spend should follow stock levels store by store.