CryptoPayr — Metin2 crypto donation module
===========================================

Accept crypto (Bitcoin, Ethereum, USDT and 30+ coins) on your Metin2 server.
Players buy "coins" on the CryptoPayr hosted checkout and the purchased item is
delivered to their account automatically once the payment is confirmed on-chain
— via a signed webhook.

How delivery works: the module inserts the item into the `item_award` table in
the `player` database (the standard item-shop / mall queue). The game hands the
item to the player the next time they log in.


1. CryptoPayr API key
---------------------
Sign up at https://cryptopayr.com, then Dashboard -> Developers and copy your
API key (sk_live_...). It is used both to create payments and to verify the
webhook signature.


2. Upload & install
--------------------
- Upload this folder to your web server (e.g. /donate), on a host that can reach
  your Metin2 MySQL databases (`account` and `player`). The site must be
  reachable over HTTPS.
- chmod 666 config.php, then open /donate/install.php and follow the steps:
  database connection (the `account` DB), table detection (account.account +
  player.item_award), and settings — including the ITEM VNUM granted per coin,
  the player DB name, price, currency, minimum and API key.
- DELETE install.php when finished.


3. Add the donation form
------------------------
Link players to form_with_ajax.php (or embed your own form posting to
payment.php with `us_account` = account login and `sum` = number of coins).


Notes
-----
- Players enter their ACCOUNT login (item delivery is keyed by login).
- ITEM_VNUM is the item the buyer receives; `count` per order equals the number
  of coins, so use a stackable donate item. Default 50300 is only a placeholder
  — set your real donate item vnum in the installer.
- The account and player databases default to `account` / `player`; change
  DB_NAME / PLAYER_DB in config.php if your server uses different names.
- The item_award columns used are (login, vnum, count, mall, why, valid). If your
  server files differ, adjust grant() in lib/Game.php.
- Orders are recorded in cryptopayr_payments (status 0/1/2) with the CryptoPayr
  transaction id. Delivery is at-most-once even if the webhook is retried.
- config.php is protected by the bundled .htaccess.


Support
-------
Docs:  https://cryptopayr.com/docs
Email: support@cryptopayr.com

MIT licensed. (c) CryptoPayr
