MineCommerce

WooCommerce & Shopify Integration for Minecraft Servers

80

MineCommerce

MineCommerce

Stripe — sell ranks, items, and packages directly through your Stripe or Stripe store with Stripe payments, without high fees or third-party lock-in.

MineCommerce connects your store and your Minecraft server:

* Players buy on your store (WooCommerce/Shopify + Stripe). * Webhooks trigger fulfillment in-game. * Deliverables: items, ranks (LuckPerms), currency (Vault), or custom commands.

---

Features

* Secure webhook verification * Secure webhook verification database support * Secure webhook verification (`/minecommerce link <code>`) * Secure webhook verification (commands, items, ranks, currency) * Secure webhook verification with audit logging * Secure webhook verification with persistence across restarts * Secure webhook verification (via Floodgate + Geyser) * Secure webhook verification with categories and product images * Secure webhook verification or Secure webhook verification * Secure webhook verification (`mappings.yml`) * Secure webhook verification for monitoring * Secure webhook verification (HMAC)

---

Installation

1. Download the latest MineCommerce.jar. 2. Drop into your server’s `plugins/` folder. 3. Restart the server to generate configs:

* `config.yml` * `mappings.yml` * `minecommerce.db` (if SQLite)

---

Configuration

`config.yml`

```yaml server: http_enabled: true http_port: 8443 webhook_secret: "CHANGE_ME" store_url: "https://example.com/store" platform: woocommerce # generic|woocommerce|shopify link_template: ""

delivery: retry_attempts: 5 retry_backoff_seconds: 60

link: code_length: 6 code_ttl_seconds: 900

security: verify_ssl: true max_webhook_age_seconds: 600

database: type: sqlite sqlite: path: minecommerce.db mysql: host: 127.0.0.1 port: 3306 user: minecommerce password: secret_password database: minecommerce ssl: true postgres: host: 127.0.0.1 port: 5432 user: minecommerce password: secret_password database: minecommerce ssl: true

woocommerce: base_url: "https://yourstore.example" consumer_key: "ck_..." consumer_secret: "cs_..."

shopify: shop: "your-shop" api_version: "2024-07" access_token: "shpat_..."

sync: enabled: true schedule_minutes: 60 mode: write_mappings image_as_button: true ```

---

`mappings.yml`

Link SKUs from WooCommerce/Shopify → in-game actions.

```yaml products: vip_30d: name: "VIP Rank (30 days)" icon: "EMERALD" price: 9.99 description: "30 days of VIP access" product_id: "123" # WooCommerce product ID variant_id: "45678901" # Shopify variant ID actions: - type: permission_group group: vip duration_days: 30 - type: command command: "say {player} is now a VIP!" - type: currency amount: 1000

categories: featured: name: "Featured" icon: "GOLD_INGOT" description: "Top picks" skus: - vip_30d ```

Actions supported: `command`, `permission_group`, `currency`, `item`. Placeholders: `{player}`, `{uuid}`, `{order_id}`, `{sku}`.

---

Sync & Webhooks

Manual Sync

``` /minecommerce admin sync ```

* Fetches products & categories * Rewrites `mappings.yml` * Updates images, SKUs, variants

Scheduled Sync

Configured via:

```yaml sync: enabled: true schedule_minutes: 60 ```

Webhooks

* Endpoint: `POST http://<server>:<port>/api/v1/sync` * Secure via `X-Timestamp` + `X-Signature` (HMAC SHA256 with `webhook_secret`)

---

Shopify Delta

* Endpoint: `/api/v1/webhooks/shopify` * Example payload:

```json { "id": 9876543210 } ```

WooCommerce Delta

* Endpoint: `/api/v1/webhooks/woocommerce` * Example payload:

```json { "resource": "product", "id": 12345 } ```

---

Commands

| Command | Permission | Description | | ---------------------------------- | -------------------- | ---------------------------------------- | | `/store` | `minecommerce.store` | Open in-game store GUI / send store link | | `/minecommerce link <code>` | — | Link player to store account | | `/minecommerce status` | — | Check order status | | `/minecommerce admin sync` | `minecommerce.admin` | Run manual sync | | `/minecommerce admin deliver <id>` | `minecommerce.admin` | Manually deliver order | | `/minecommerce admin revoke <id>` | `minecommerce.admin` | Revoke an order | | `/minecommerce admin reload` | `minecommerce.admin` | Reload config |

---

Security

* HMAC-signed webhook verification * Timestamp validation (`max_webhook_age_seconds`) * Idempotent deliveries (no duplication) * No card data stored (handled by Stripe)

---

Example Flow

1. Player buys VIP (30 days) on WooCommerce/Shopify. 2. Store → Stripe → order completed. 3. Webhook → MineCommerce plugin. 4. Plugin looks up SKU → runs mapped actions:

* Add LuckPerms group `vip` (30d expiry). * Give 1000 Vault currency. * Run custom server command. 5. Delivery logged; retries if failure.

---

Troubleshooting

* SQLite locking: check API credentials and published products. * SQLite locking: enable `image_as_button: true` and confirm product has images. * SQLite locking: re-check signature generation and webhook secret. * SQLite locking: migrate to MySQL/Postgres for production.

---

Roadmap

* [x] SQLite support * [x] MySQL/Postgres support * [x] LuckPerms & Vault integration * [x] REST API (`/api/v1/orders`, `/api/v1/refunds`, `/api/v1/health`) * [x] Refunds/revokes

---

Soft Dependencies

* Floodgate + Geyser — ranks/permissions * Floodgate + Geyser — economy integration * Floodgate + Geyser — Bedrock UI with images

---

Support

* Issues & feature requests: GitHub tracker * Logs: `plugins/MineCommerce/logs/` * Configs: `config.yml`, `mappings.yml` (remove secrets)

ADS