Pls test my script

not really.

  1. intermediate table PRODUCTS is not required, you can define REWARDS table with the same data instead
  2. should not this return NotProcessedYet to avoid multiple purchases of already owned item?image