# Automatic Store 🛒

{% hint style="danger" %}
⭐ This plugin is private! Can be purchased on our [Discord Marketplace](https://discord.com/invite/Tzmq98gwqF).
{% endhint %}

{% hint style="info" %}
It is used to create an automated store on your Discord server with integrated PayPal payments. Use it to sell VIP memberships, credits, special Discord roles, and much more. Our solution works just like the Marketplace on the SourceFactory Discord and offers you unlimited product creation possibilities.\
\
• After an order is paid, you can automatically perform the following actions:

> 1. Send commands to your CS2 server
> 2. Assign a special discord roles to the user
> 3. Execute any SQL command to your MySQL database

> The plugin includes extensive configuration options, allowing you to set up products for individual servers (up to 25 products per CS2 server), customize embed messages, and much more.
> {% endhint %}

<details>

<summary>Config Preview</summary>

```
{
  "Response Server": false,
  "Live Mode": false,
  "Currency": "EUR",
  "Allow Unlinked Users To Create Orders": false,
  "Database Connection": {
    "Host": "",
    "Port": 3306,
    "User": "",
    "Database": "",
    "Password": ""
  },
  "PayPal Account": {
    "Name": "Name",
    "Surname": "Surname",
    "Email": "Email",
    "Client ID": "",
    "Secret": ""
  },
  "Invoice Data": {
    "Note": "After paying for your order, you will receive your VIP benefits within 5 minutes! If there is any problem, please contact us.",
    "Term": "No refunds.",
    "Tax ID": "",
    "Website": "https://sourcefactory.eu",
    "Logo URL": "https://i.imgur.com/P8SYw0H.png",
    "Invoice Lifetime": 120
  },
  "Servers List": [
    "Public",
    "Only Mirage"
  ],
  "Actual Server": "Public",
  "Messages List": {
    "1": {
      "Embed": {
        "Content": "",
        "Title": "Public Server \u2022 Store",
        "Description": "\u003E Buy VIP on our Public server using the PayPal payment gateway! After completing the payment, VIP will be added to you within 5 minutes!",
        "Thumbnail": "",
        "Image": "",
        "HEXColor": "#99ff33",
        "Footer": "",
        "FooterTimestamp": false
      },
      "Products": [
        {
          "Name": "VIP 1 Month - Public",
          "Price": 9.99,
          "CommandsAfterPurcharse": [
            {
              "Key": "Public",
              "Value": "say {USERNAME} ({STEAMID}) purchased VIP for 1 month!"
            },
            {
              "Key": "Public",
              "Value": "css_addvip {STEAMID}"
            }
          ],
          "RolesAfterPurcharse": [
            "YOUR_ROLE_ID",
            "YOUR_ROLE_ID2"
          ],
          "SQLCommandAfterPurcharse": "",
          "Button": {
            "Text": "Buy VIP (1 Month) - 9.99\u20AC",
            "Color": 2,
            "Emoji": ":euro:"
          }
        },
        {
          "Name": "VIP 3 Months - Public",
          "Price": 15.99,
          "CommandsAfterPurcharse": [
            {
              "Key": "Public",
              "Value": "say {USERNAME} ({STEAMID}) purchased VIP for 1 month!"
            },
            {
              "Key": "Public",
              "Value": "css_addvip {STEAMID}"
            }
          ],
          "RolesAfterPurcharse": [],
          "SQLCommandAfterPurcharse": "",
          "Button": {
            "Text": "Buy VIP (3 Months) - 15.99\u20AC",
            "Color": 3,
            "Emoji": ":euro:"
          }
        }
      ]
    },
    "2": {
      "Embed": {
        "Content": "",
        "Title": "",
        "Description": "",
        "Thumbnail": "",
        "Image": "",
        "HEXColor": "#99ff33",
        "Footer": "",
        "FooterTimestamp": false
      },
      "Products": [
        {
          "Name": "100 Credits - Only Mirage",
          "Price": 4.99,
          "CommandsAfterPurcharse": [
            {
              "Key": "Only Mirage",
              "Value": "say {USERNAME} ({STEAMID}) purchased 100 credits!"
            },
            {
              "Key": "Only Mirage",
              "Value": "css_addcredits {STEAMID} 100"
            }
          ],
          "RolesAfterPurcharse": [
            "YOUR_ROLE_ID",
            "YOUR_ROLE_ID2"
          ],
          "SQLCommandAfterPurcharse": "",
          "Button": {
            "Text": "Buy 100 Credits - 4.99\u20AC",
            "Color": 2,
            "Emoji": ":moneybag:"
          }
        },
        {
          "Name": "200 Credits - Only Mirage",
          "Price": 9.99,
          "CommandsAfterPurcharse": [
            {
              "Key": "Only Mirage",
              "Value": "say {USERNAME} ({STEAMID}) purchased 200 credits!"
            },
            {
              "Key": "Only Mirage",
              "Value": "css_addcredits {STEAMID} 200"
            }
          ],
          "RolesAfterPurcharse": [],
          "SQLCommandAfterPurcharse": "",
          "Button": {
            "Text": "Buy 200 Credits - 9.99\u20AC",
            "Color": 3,
            "Emoji": ":moneybag:"
          }
        }
      ]
    }
  },
  "Log Messages": {
    "When Order Created": true,
    "When Order Cancelled": true,
    "When Order Expired": true,
    "When Order Paid": true
  },
  "Response Embeds": {
    "Confirm Purchase": {
      "Content": "",
      "Title": "",
      "Description": "\u003E Please confirm the creation of an order for product \u0060{PRODUCT}\u0060\n\u003E -# SteamID: \u0060{STEAMID}\u0060",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#00ffcc",
      "Footer": "",
      "Footer Timestamp": false,
      "Confirm Order Button": {
        "Button Text": "Create an order ({PRICE}\u20AC)",
        "Button Color": 3,
        "Button Emoji": ":shopping_cart:"
      },
      "Edit SteamID Button": {
        "Enabled": true,
        "Button Text": "Edit the SteamID",
        "Button Color": 1,
        "Button Emoji": ":pencil:",
        "Modal": {
          "Modal Name": "Insert Steam ID",
          "Value Label": "Which SteamID to create an order on?"
        }
      }
    },
    "Order Created": {
      "Content": "",
      "Title": "The order has been created!",
      "Description": "\u003E Product: \u0060{PRODUCT}\u0060\n\u003E Price: \u0060{PRICE}\u20AC\u0060\n\u003E Order Expiration: \u0060{EXPIRATION}\u0060\n\n\u003E After payment, the purchased product will be activated within 5 minutes!",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#ff9933",
      "Footer": "If you have any problems with your order, please contact us via ticket",
      "Footer Timestamp": false,
      "Checkout Button": {
        "Button Text": "Checkout",
        "Button Emoji": ""
      },
      "Cancel Order Button": {
        "Button Text": "Cancel order",
        "Button Color": 4,
        "Button Emoji": ":heavy_multiplication_x:"
      }
    },
    "Order Sent": {
      "Content": "",
      "Title": "",
      "Description": "\u003E Your order has been created! Checkout URL has been sent to direct message.",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#00ccff",
      "Footer": "",
      "Footer Timestamp": false
    },
    "Order Paid": {
      "Content": "",
      "Title": "",
      "Description": "\u003E Thank you for your purchase! :heart:\n\u003E Your purchased \u0060{PRODUCT}\u0060 product has been successfully activated!",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#ffdb4d",
      "Footer": "",
      "Footer Timestamp": false
    },
    "Order Cancelled": {
      "Content": "",
      "Title": "",
      "Description": "\u003E Your order for product \u0060{PRODUCT}\u0060 has been cancelled.",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#ff0066",
      "Footer": "",
      "Footer Timestamp": false
    },
    "Order Failed": {
      "Content": "",
      "Title": "",
      "Description": "\u003E Could not create an order, you probably have private messages disabled!",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#ff3333",
      "Footer": "",
      "Footer Timestamp": false
    },
    "Order Already Created": {
      "Content": "",
      "Title": "",
      "Description": "\u003E You have already created an order for product **{PRODUCT}**",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#ff4d4d",
      "Footer": "",
      "Footer Timestamp": false
    },
    "Not Linked": {
      "Content": "",
      "Title": "",
      "Description": "\u003E You can\u0027t create an order because you don\u0027t have your Discord account linked to your Steam profile!",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#ff4d4d",
      "Footer": "",
      "Footer Timestamp": false
    },
    "Invalid SteamID Format": {
      "Content": "",
      "Title": "",
      "Description": "\u003E The SteamID \u0060{STEAMID}\u0060 is in invalid format!",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#ff4d4d",
      "Footer": "",
      "Footer Timestamp": false
    }
  },
  "ConfigVersion": 1
}
```

</details>

{% embed url="<https://youtu.be/9DRg7VRhSJw>" %}

<details>

<summary>Images</summary>

<img src="https://799349702-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrczaiIR8LCIvnID1U1Ty%2Fuploads%2FvsHQOkQWsnsOk94JjxLW%2FStore_Message.png?alt=media&#x26;token=f55ef153-b508-4b60-81dc-df73d0e64486" alt="" data-size="original"><img src="https://799349702-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrczaiIR8LCIvnID1U1Ty%2Fuploads%2F06wPwOLHOCB9eKynXNb7%2FStore_OrderCancelled.png?alt=media&#x26;token=fded9590-6176-4d99-8c39-6e85660e1544" alt="" data-size="original"><br>

<img src="https://799349702-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrczaiIR8LCIvnID1U1Ty%2Fuploads%2FQ67spefOYFnZ61ES7oxb%2FStore_OrderCreated.png?alt=media&#x26;token=d23cdaf4-cd2e-4da7-a685-f88da747a1e3" alt="" data-size="original"><img src="https://799349702-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrczaiIR8LCIvnID1U1Ty%2Fuploads%2F4X4YdcAvzJ1maIJR7eI3%2FStore_OrderPaid.png?alt=media&#x26;token=e0bb753d-0ea4-46f1-8862-a57da40d1ccc" alt="" data-size="original">

</details>

### Main Configuration

<table><thead><tr><th width="208">Property</th><th>Value</th></tr></thead><tbody><tr><td><strong>Response Server</strong></td><td>Determines which server creates replies to messages, PayPal orders, checks, etc.. <mark style="color:red;">Only one server can have Response server enabled!</mark> <br>( <mark style="color:green;"><code>true</code></mark> / <mark style="color:red;"><code>false</code></mark> )</td></tr><tr><td><strong>Live Mode</strong></td><td>If PayPal Live Mode will be enabled (If this value is false, Sandbox mode will be used)<br><a href="https://i.imgur.com/vOtLE95.png">What's the Live and Sandbox mode</a></td></tr><tr><td><strong>Currency</strong></td><td><a href="https://developer.paypal.com/docs/reports/reference/paypal-supported-currencies/">Available currencies</a></td></tr><tr><td><strong>Allow Unlinked Users To Create Orders</strong></td><td>If unlinked users can create orders, if this feature is enabled, they must enter SteamID64 when creating an order ( <mark style="color:green;"><code>true</code></mark> / <mark style="color:red;"><code>false</code></mark> )</td></tr></tbody></table>

### PayPal Account

<table><thead><tr><th width="128">Property</th><th>Value</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>Your name</td></tr><tr><td><strong>Surname</strong></td><td>Your surname</td></tr><tr><td><strong>Email</strong></td><td>Email of your PayPal account</td></tr><tr><td><strong>Client ID</strong></td><td>Client ID of your PayPal account (If Live Mode is enabled use Live Client ID otherwise use Sandbox Client ID)<br><a href="https://www.upwork.com/resources/paypal-client-id-secret-key">How to get a PayPal Client ID &#x26; Secret</a></td></tr><tr><td><strong>Secret</strong></td><td>Secret of your PayPal account (If Live Mode is enabled use Live Secret otherwise use Sandbox Secret<br><a href="https://www.upwork.com/resources/paypal-client-id-secret-key">How to get a PayPal Client ID &#x26; Secret</a></td></tr></tbody></table>

### Invoice Data

<table><thead><tr><th width="178">Property</th><th>Value</th></tr></thead><tbody><tr><td><strong>Invoice Lifetime</strong></td><td>Lifetime of the created order/invoice (<mark style="color:blue;"><code>minutes</code></mark>)</td></tr><tr><td><strong>Note</strong></td><td>---></td></tr><tr><td><strong>Term</strong></td><td>------></td></tr><tr><td><strong>Tax ID</strong></td><td>---------> Invoice Details (Can be empty)</td></tr><tr><td><strong>Website</strong></td><td>------></td></tr><tr><td><strong>Logo URL</strong></td><td>---></td></tr></tbody></table>

### Servers Data

<table><thead><tr><th width="177">Property</th><th>Value</th></tr></thead><tbody><tr><td><strong>Servers List</strong></td><td>List the name of all your servers (All servers must have the same list of servers!)</td></tr><tr><td><strong>Actual Server</strong></td><td>The name of the current server from your <code>Servers List</code><br>(Each server must have its own server name set from the Servers List)</td></tr></tbody></table>

### Messages List

> Used to create embed messages and products (This means that each message has its own products)

<table><thead><tr><th width="187">Property</th><th width="262">Section Property</th><th>Value</th></tr></thead><tbody><tr><td><strong>Embed</strong> Section</td><td>-------------></td><td>What the embed message will look like</td></tr><tr><td><strong>Products</strong> Section</td><td>-------------></td><td>List of all products for actual message</td></tr><tr><td></td><td><strong>Name</strong></td><td>Name of the product</td></tr><tr><td></td><td><strong>Price</strong></td><td>Price of the product</td></tr><tr><td></td><td><strong>CommandsAfterPurcharse</strong></td><td>List of commands that will be sent to the server.<br><strong><code>Key ></code></strong><code> Means the name of the server from the Servers List</code><br><strong><code>Value ></code></strong><code> The exact command that will be sent</code></td></tr><tr><td></td><td><strong>RolesAfterPurcharse</strong></td><td>List the Role IDs that will be assigned to the user</td></tr><tr><td></td><td><strong>SQLCommandAfterPurcharse</strong></td><td>SQL command that will be sent to your MySQL database</td></tr><tr><td></td><td><strong>Button</strong></td><td>What the button will look like</td></tr></tbody></table>

{% hint style="warning" %}

### How to send an embed message with products

* In the server console, type: <mark style="color:green;">`css_du_storemessage <message> <channel_id>`</mark>

&#x20;      \- Message means: Message ID from Messages List
{% endhint %}

{% hint style="success" %}
**To edit the embeds, follow the instructions:** [**Custom Embeds Format**](https://docs.sourcefactory.eu/discord-utilities/tutorials/custom-embeds-format)&#x20;

> Available Variables

&#x20;**•** <mark style="color:blue;">{PRODUCT}</mark> > Name of the product\
&#x20;**•** <mark style="color:blue;">{PRICE}</mark> > Price of the product\
\
&#x20;**•** <mark style="color:blue;">{INVOICEID}</mark> > Invoice ID\
&#x20;**•** <mark style="color:blue;">{USERNAME}</mark> > Discord Name of the user who created the order\
&#x20;• <mark style="color:blue;">{USERID}</mark> > Discord ID of the user who created the order\
&#x20;**•** <mark style="color:blue;">{STEAMID}</mark> > SteamID64 of the user who created the order
{% endhint %}
