Documentation
R_Store

r_store Tebex Integration

Sell r_store credits on Tebex and deliver them automatically: create the license variable, attach it to a package, add the game server command.

Overview

R_Store runs on a custom credit balance (the r_store_players table). With Tebex you can sell credit packages on your webstore and have them delivered automatically the moment a player pays, using Tebex's built-in Game Server Commands.

When a package is purchased, Tebex runs this command on your server:

r_store:giveCredits {amount} {license}
  • {amount}: how many credits the player receives (you set this per package).
  • {license}: the player's R_Store account, provided by the buyer at checkout via a Tebex variable. They get this value in-game with the /storelicense command (it copies their license to the clipboard).

Credits are stored on the player's account, so delivery works whether the buyer is online or offline. The account row is created on the first grant, so the buyer does not need to have opened the store before.

Prerequisites

Tebex store connected to your server

Your Tebex store must be linked to your FiveM server so Game Server Commands can run. See Tebex → Game Servers.

R_Store installed

R_Store is installed and working, and players can open it in-game.

Step 1: Create the License variable

In Tebex, create a variable players will fill in at checkout with their in-game license.

Open Variables → Create Variable

Fill in the fields

  • Identifier: License
  • Description: Use command: /storelicense in game to get your license
  • Type: Text
  • Validation: enable Letters and Numbers
  • Leave Min Length and Max Length empty

Click Create

The description is shown to the buyer at checkout. Telling them to run /storelicense is what makes the whole flow self-service.

Step 2: Attach the variable to your package

Create your credit package, then add the {license} variable to it.

Create or edit a credit package

Open the package's Variables tab

Select the license variable

Choose the {license} variable you created in Step 1 from the dropdown.

Step 3: Add the Game Server Command

Deliver the credits when the package is purchased.

Add Deliverable → Game Server Commands

Select your game server(s)

Pick the server(s) the customer should receive the package on.

Add the command

Set the trigger to When the package is purchased and enter:

r_store:giveCredits 1000 {license}

The 1000 is an example. It's the number of credits this package gives. Match it to the package (e.g. a 5,000 Credits package uses r_store:giveCredits 5000 {license}).

That's it. When a player buys the package and enters their license at checkout, Tebex runs the command and the credits land on their R_Store account.

How the player buys credits

Get their license in-game

The player runs /storelicense (copies their license to the clipboard).

Buy the package on your webstore

At checkout, Tebex asks for the License variable. They paste the value.

Receive credits automatically

Tebex runs r_store:giveCredits and the credits appear in the store (online or on next open).

Troubleshooting

Support

Remember to comply with Tebex's terms of service and your local laws regarding virtual goods sales.