Module 7 · In Studio · challenge 1 of 2 in this lesson

A second developer product grants 20 coins (SECOND_PACK_COINS = 20) through the same ProcessReceipt

A test in Studio grades it and prints a pass code.

Open

Level 3, Professional

Challenge

Add a second developer product (granting 20 coins) to MonetizationService. The test is challenges/monetization.luau and the solution is challenges/solutions/monetization.md. Do not create a product in Creator Hub for the test. Run the test with the command in the footer. Keep the safe order of m14-ship: the id goes into the profile with the coins, one save waits, and the purchase is still recorded once. The test reads the profile, and no r_<purchaseId> row is written.

Start from
The game at milestone m14 (download)
Grade it
In Studio, press Play, then run game.ServerScriptService.RunGameTests:Invoke("monetization", "monetization-second-product") in the server command bar. Copy the pass code from Output.

Done means

  • A second developer product grants 20 coins (SECOND_PACK_COINS = 20) through the same ProcessReceipt
  • The same purchase id delivered twice grants once, and the id is in the profile's recentPurchaseIds exactly once, in the live profile and in the saved copy, with the same coins
  • The test product id comes from workspace:GetAttribute("TestSecondProductId"), and the Coin Pack still grants 50
  • Self-check, the test does not grade it: the Coin Pack id is read from Ids, and the product is off when its id is 0
  • challenges/monetization.luau prints TEST PASS for every check

The Course Runner prints this code when the test passes.