Is It Riba?
Riba is only in loan transactions. With that understanding, there’s no question of riba in either one of your examples.