Retrieve offers
This page gives information about how to get a AI in-game shop offer from TentuPlay database. You will learn the following:
-
The prerequisites that are required
-
Module, classes, and methods that are applicable
-
How to get an AI offer data
Prerequisites
This page assumes that you are finished with the following:
-
You have created a TentuPlay account and a project in console
-
You have configured your roblox game and TentuPlay plugin
-
You have completed the configuration for data collection and upload
Module, class, and methods in use
When ShowOfferById
or ShowLatestOffer
is called, TPPersonalizedOffer module will dynamically retrieve offers by player (namely, userId) and returns you the data table for your use.
-
ShowOfferById
andShowLatestOffer
are methods of theTPPersonalizedOffer
module. -
TPPersonalizedOffer
is a module for retrieving TentuPlay Personalized Offers and AI In-Game Shop offers
Request an offer
-
Call
ShowOfferById
orShowLatestOffer
by usingTPPersonalizedOffer
module’s function as shown in the code example.Code examplelocal ReplicatedStorage = game:GetService("ReplicatedStorage") local TentuplaySDKModules = ReplicatedStorage["tentuplay-sdk-modules-ReplicatedStorage"] local TPPersonalizedOffer = require(TentuplaySDKModules.TPPersonalizedOffer) function showPersonalizedOffer() while true do wait(5) local response = TPPersonalizedOffer.GetOffersAsync(player.UserId) for _, offer in pairs(response) do local offerByIdCallback = TPPersonalizedOffer.ShowOfferById(player.UserId,"EN", offer.offer_id) end end end local personalizedOfferCoroutine = coroutine.create(showPersonalizedOffer) coroutine.resume(personalizedOfferCoroutine)
-
Now, the offer appears on the screen