# Sell a VIP with Pix and automatic delivery

A live store that takes Pix and delivers the VIP to the character on its own, with the first order delivered.

Source: https://fivedash.fivex.gg/docs/en/tutorials/sell-vip-with-pix

In this tutorial you open your city's store, connect a Pix provider, add a VIP with in-game delivery, put the website live and follow the first purchase all the way to the character. The money goes straight to the city's provider account, without passing through FiveDash. It's for the owner or whoever runs the store.

## What you need

* A Brazilian organization with the **Store** module in its plan (Plus, Pro or Ultra). International organizations don't get the Store, not even in the free trial.
* The server connected to FiveDash, with a started MySQL driver (`oxmysql`, `mysql-async` or `ghmattimysql`). See [Connect your city to FiveDash](https://fivedash.fivex.gg/docs/en/tutorials/connect-your-city).
* Delivery turned on in `fivedash/loja.lua`: `Enabled = true`, which is the default.
* An account cleared to receive payments with Mercado Pago, AbacatePay, Stripe or PicPay.
* The **Configure** level on **Store → Overview**.

## 1. Build your store

Open **Store** in the sidebar. Under **What will you sell?**, tick **VIPs** (and whatever else the city sells). Under **Store color**, pick a color. Click **Create store**.

Setup has four steps. Each one is saved as soon as you finish it, so you can close the page and pick up later.

## 2. Connect Pix

On the **Get paid** step, pick the provider and paste its credential:

| Provider         | Pix                                        | Credential                          | Starts with |
| ---------------- | ------------------------------------------ | ----------------------------------- | ----------- |
| **Mercado Pago** | Yes (and card)                             | **Access Token**                    | `APP_USR-`  |
| **AbacatePay**   | Yes                                        | **API key**                         | `abc_prod_` |
| **Stripe**       | When it's turned on in your Stripe account | **Restricted key**                  | `rk_live_`  |
| **PicPay**       | Yes                                        | **Client ID** and **Client Secret** | No prefix   |

Under **Use Mercado Pago for** (your provider's name shows), turn on **Pix**. Click **Connect Mercado Pago**. It worked when **Account connected** shows. Where to get each credential is in [Payments](https://fivedash.fivex.gg/docs/en/store/payments).

> A test key shows **Test key** on the provider's card: payments are simulated. Switch to the production key before selling. For PicPay, once the store is open, copy the notice address in **Store → Payments** (**Copy notice address**, on the PicPay card) and paste it in PicPay's merchant panel, under **Ajustes** → **Meu checkout** → **URL de notificação**.

## 3. Choose who gets it and open the store

On the **In-game delivery** step, answer **How does the buyer say who gets it?**:

* **City ID** (with the name the framework uses, such as "Citizen ID" or "State ID"): the player types their ID at checkout, and the city checks whose it is before payment.
* **Discord account**: the player signs in with Discord, and the purchase goes to the character linked to it.

Click **Continue**. On the last step, FiveDash checks the server and payments. Click **Open store**. It worked when **Cidade Exemplo is ready!** shows (with your server's name). Click **Go to the store**.

If something is missing, fix the item it points to and click **Check again**:

| Message                                     | What to do                                                             |
| ------------------------------------------- | ---------------------------------------------------------------------- |
| **Install FiveDash on the server**          | Install the resource and connect the server                            |
| **Restart the server to finish the update** | Restart the server or run `restart fivedash`                           |
| **Turn on delivery on the server**          | Set `Enabled = true` in `fivedash/loja.lua` and run `restart fivedash` |
| **Framework not recognized**                | Run `fivedash detect` in the server console                            |

## 4. Add the VIP

Products live inside categories. In **Store → Categories**, click the **VIPs** shortcut under **Based on what you sell** (or **New category**) and then **Create category**.

Now go to **Store → Products**, pick the **VIPs** category and click **Add product**:

1. In **Details**, enter the **Name** (e.g. Gold VIP) and, if you want, the **Description**.
2. In **Price**, enter the amount (from R$ 0.50 to R$ 50,000.00).
3. In **In-game delivery**, click **Add delivery** and pick **VIP or role**. Fill in the **Framework group** (no spaces, e.g. `vip_gold`) and the **Duration** in days (default 30) or **Permanent**.
4. Keep the **Status** on **On sale** and click **Save**.

Saved as **On sale**, the product shows in the store right away. If its card shows **No delivery set up**, the player pays and gets nothing in the city.

> **FiveM**
>
> What the **Framework group** becomes depends on the framework:
>
> | Framework                  | The group becomes                                                                                              |
> | -------------------------- | -------------------------------------------------------------------------------------------------------------- |
> | ESX                        | A job in `job_grades` (`police` or `police.2`) or, with any other name, the ACE group `group.<name>`           |
> | QBCore                     | A job in `QBCore.Shared.Jobs`, a gang in `Shared.Gangs` or, with any other name, the ACE group `qbcore.<name>` |
> | Qbox                       | A job or gang or, with any other name, the ACE group `group.<name>`                                            |
> | ox_core                    | An ox_core group that exists in `ox_group_grades`                                                              |
> | vRP / vRPex                | A group in `vrp/cfg/groups.lua`                                                                                |
> | Creative Network Enchanted | A group in `vrp/config/Groups.lua`                                                                             |
>
> For an ACE group, give it its permissions in `server.cfg` and check them in scripts with `IsPlayerAceAllowed`. For example, for the `group.vip` group:
>
> ```bash
> add_ace group.vip vip allow
> ```

> **RedM**
>
> On RedM, the **Framework group** follows the framework:
>
> * **VORP:** `job.<name>` (or `job.<name>.<grade>`, like `job.sheriff.2`) becomes a job; `char.<name>` becomes the character's group (up to 10 letters); any other name becomes the ACE group `group.<name>` on the Steam.
> * **RSG:** a job or gang from the base (`vallaw` or `vallaw.2`); any other name becomes the ACE group `rsgcore.<name>` on the license.
>
> To sell horses and wagons, see [Sell horses and wagons on RedM](https://fivedash.fivex.gg/docs/en/tutorials/redm-store-horses).

## 5. Put the website live

Go to **Store → Website**. At the top, turn on the switch next to **Offline**: it changes to **Live**. Click **Save** in the bar that shows up at the bottom. It worked when **The website is live** shows.

The website is on the free address `<address>.fivedash.shop` (e.g. `cidadeexemplo.fivedash.shop`). To get the link, open the **View site** menu at the top of the store pages and click **Copy address**. Colors, logo, banner and your own domain (on Pro or above) are in [Store website](https://fivedash.fivex.gg/docs/en/store/site).

## 6. Test a purchase

First, check that payments reach FiveDash. In **Store → Payments**, click **Test** on the provider's card and then **Create charge**. Pay the R$ 1,00 **Pix QR code**. It worked when **Payment confirmed!** shows. With a production key it's a real charge, and the money goes to your provider account (minus the fee).

Then buy the VIP as a player:

1. Open the website and click **Sign in with Discord**.
2. On the VIP's page, click **Add to cart**. In the **Cart**, click **Go to checkout**.
3. Under **Who gets it in the city**, enter your character's ID (if the store uses **City ID**). Checkout checks the ID and shows the character's name.
4. Under **How to pay**, pick Pix and pay with the QR code or **Pix copy and paste**.

The order page updates by itself once the payment goes through.

## 7. See the order delivered

In **Store → Orders**, the order is at the top of the list with **Payment** on **Paid**. When the city delivers, **Delivery** changes to **Delivered**. Opened, the order shows **Delivered in the city**.

In the game, with `Notify = true` in `loja.lua` (the default), the player sees "Your purchase #N has arrived" on screen, with what they got.

The VIP is delivered right away, with the player online or offline, on almost every framework. On vRP / vRPex, it waits for the player to join. On VORP, a job or character group waits if they're on the server with another character.

If **Delivery** stays on **Failed**, open the order and read the reason. If the ID was wrong, fix it in **Game ID** and click **Resend to the city**: only what failed goes back to the queue, and no delivery is ever given twice.

## Next steps

[Products](https://fivedash.fivex.gg/docs/en/store/products)

Prices, stock, images and every delivery type.

[Payments](https://fivedash.fivex.gg/docs/en/store/payments)

Each provider's credentials and charge statuses.

[In-game delivery](https://fivedash.fivex.gg/docs/en/store/in-game-delivery)

What each framework delivers, online and offline.

[Orders](https://fivedash.fivex.gg/docs/en/store/orders)

Follow, resend and mark deliveries.
