1. Go to this page and download the library: Download anvilm/spworlds library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
anvilm / spworlds example snippets
use Anvilm\SPWorlds\API;
$SPWorlds = new API($id, $token);
$SPWorlds->APIService->cardInfo()
$discordId = 'discord_id'; //Discord id игрока
$SPWorlds->APIService->getUsername($discordId);
$username = 'user_name'; //Ник игрока
$SPWorlds->APIService->getCards($username);
$SPWorlds->APIService->getOwner();
//Массив предметов на покупку
$items = [
[
'name' => 'item_name', //Имя предмета
'count' => '10', //Количество предметов
'price' => '1', //Цена за штуку
'comment' => 'some comment' //Комментарий
]
];
$redirectUrl = 'https://redirect.url'; //Ссылка для переадрессации пользователя
$webhookUrl = 'https://webhook.url'; //Вебхук
$data = 'some data'; //Любая информация
$SPWorlds->APIService->payment($items, $redirectUrl, $webhookUrl, $data);