Forest Logo
search
package_2

checkout

By @lucasx150

Roblox

Mirrored

Checkout

Checkout is a DevProduct and Gamepass handler for Roblox. It lets you define grant logic as individual ModuleScripts, automatically handles ProcessReceipt, checks gamepass ownership on player join, supports client side handlers, and lets you grant DevProducts or Gamepasses directly without a real purchase.

Setup

Server:

local Checkout = require(path.to.Checkout)

-- Register all DevProducts and Gamepasses from a container
Checkout.RegisterDevProductsIn(path.to.DevProducts)
Checkout.RegisterGamepassesIn(path.to.Gamepasses)

-- Register client-side handlers (replicated to the client automatically)
Checkout.RegisterClientDevProductsIn(path.to.ClientDevProducts)
Checkout.RegisterClientGamepassesIn(path.to.ClientGamepasses)

Client:

-- The server moves CheckoutClient into ReplicatedStorage on startup
require(game:GetService("ReplicatedStorage"):WaitForChild("CheckoutClient"))

Structure

Checkout is driven by ModuleScripts organised into folders. Each folder is passed to a Register...In call, and Checkout will pick up every ModuleScript inside it.

ServerScriptService
├── ServerSetup.server.luau  -- the Register...In calls above
├── DevProducts
│   ├── Coins.luau
│   └── Revive.luau
├── Gamepasses
│   └── VIP.luau
├── ClientDevProducts       -- optional, for client-side effects
│   └── Coins.luau
└── ClientGamepasses        -- optional
    └── VIP.luau

A runnable version of this layout, with both entry point scripts, is in Example/.

A server and client module for the same item can exist independently - you don't need both. A DevProduct with only a client module and no server module is valid (e.g. cosmetic effects that don't need server state).

Server modules

Server modules run on the server when a matching DevProduct is purchased or when a player owns a matching Gamepass.

  • Ids - array of DevProduct or Gamepass ids this module handles.
  • Grant - called from the server for matching ids.

For DevProducts, return true or Enum.ProductPurchaseDecision.PurchaseGranted on success. Return false or Enum.ProductPurchaseDecision.NotProcessedYet to signal failure.

Return false or Enum.ProductPurchaseDecision.NotProcessedYet to signal failure. If no server module exists, the product is treated as client-only.

-- DevProduct
local DevProduct = {}

DevProduct.Ids = {01234, 56789}
DevProduct.Grant = function(player: Player, productId: number, receiptInfo): Enum.ProductPurchaseDecision | boolean
    -- grant the product to the player
    return Enum.ProductPurchaseDecision.PurchaseGranted
end

return DevProduct

Gamepass module

Each Gamepass module handles one or more gamepass Ids.

  • Ids - array of Gamepass ids this module handles.
  • Grant - called from the server when a player owns a gamepass with an id that is in Ids.

If no server module exists, the product is treated as client-only.

-- Gamepass
local Gamepass = {}

Gamepass.Ids = {2345, 6789}
Gamepass.Grant = function(player: Player, gamepassId: number)
    -- grant the gamepass to the player
end

return Gamepass

Client modules

Client modules run on the purchasing player's client after the (if existing) server handler succeeds.

  • Ids - array of ids this module handles, matching the server-side module.
  • Grant - called on the client after a successful server grant.
-- ClientDevProduct
local DevProduct = {}

DevProduct.Ids = {01234}
DevProduct.Grant = function(productId: number)
    -- e.g. play a sound or show an effect
end

return DevProduct
-- ClientGamepass
local Gamepass = {}

Gamepass.Ids = {2345}
Gamepass.Grant = function(gamepassId: number)
    -- e.g. update the local UI
end

return Gamepass

Signals

Checkout fires signals after a successful purchase grant. This could, for example, be used for logging.

Checkout.DevProductPurchased:Connect(function(player: Player, productId: number, receiptInfo)
    print(player, "bought DevProduct", productId)
end)

Checkout.GamepassPurchased:Connect(function(player: Player, gamepassId: number)
    print(player, "bought Gamepass", gamepassId)
end)

These fire only for real purchases, not for Checkout.GrantDevProduct / Checkout.GrantGamepass or for gamepasses the player already owned on join.

Manual granting

Checkout also lets you give DevProduct or Gamepass perks to players from other sources. This can be used for admin commands.

Checkout.GrantDevProduct(player, productId)
Checkout.GrantGamepass(player, gamepassId)

Legacy ProcessReceipt

If you have existing ProcessReceipt logic for DevProducts not managed by Checkout:

Checkout.AddToProcessReceipt(function(receiptInfo)
    -- your other ProcessReceipt callback
end)

Package Details

Install command (Click to copy)


Version

0.1.1

License

MIT

check_circle

Safe for commercial use

infoThe package archive does not include its license text; the license is declared in its manifest metadata.

Automated license review — not legal advice.