API Royale

API Royale allows ROY ecosystem apps and games to interact with Crypto Royale in-game wallets, bypassing the Blockchain. This has several advantages:

To use API Royale, ecosystem devs need to:

  1. Set-up Discord authentication on their end, (CR uses Discord IDs as reference)
  2. Set-up an API account (done manually at the moment, contact us)
  3. Direct users to https://cryptoroyale.one/apps where they can give your app permission to access their wallet.

Info needed to set-up an API account:

In return you will receive a key that is needed for all API calls. This key must be held securely at all times. Make sure to not share it with anyone. If your key is compromised, please contact us immediately.

API Endpoints

POST /api/royale/decrement

Description: Transfer funds from user wallet to API wallet. Only possible if your API has been given the decrement permission by the user.

Body parameters:

Return Messages and HTTP codes:

Body Example:

{
    "key": "d7e60d03-5121-4d37-926e-daaa9a1ef5ca",
    "amount": 100,
    "discordid": "85405022041071626",
    "reason": "test-decrement",
    "data": {"howdy": "sir"},
    "nonce": "7"
}

POST /api/royale/increment

Description: Transfer funds from API wallet to user wallet. Only possible if your API has been given the increment permission by the user.

Body parameters:

Return Messages and HTTP codes:

Body Example:

{
    "key": "d7e60d03-5121-4d37-926e-daaa9a1ef5ca",
    "amount": 50,
    "discordid": "85405022041071626",
    "reason": "test-incremenent",
    "data": {"howdy": "sir"},
    "nonce": "332"
}

POST /api/royale/balance

Description: Check how much ROY is in your API wallet. All increments and decrements happen between user wallets and your API wallet. If your API wallet reaches 0, you will not be able to increment user wallets anymore. Your API balance will NOT be immediately withdrawable, to give user's adequate time to report any incorrect charges.

Body parameters: Return Messages and HTTP codes:

Body Example:

{
    "key": "d7e60d03-5121-4d37-926e-daaa9a1ef5ca",
}

POST /api/royale/userbalance

Description: Check how much ROY is in a user's wallet. Only possible if your API has been given the userbalance permission by the user.

Body parameters:

Return Messages and HTTP codes:

Body Example:

{
    "key": "d7e60d03-5121-4d37-926e-daaa9a1ef5ca",
    "discordid": "85405022041071626"
}

POST /api/royale/userpermissions

Description: Check which permissions your app has been given, by a specific user. Ideally your app should degrade its UX gracefully, if less permissions are given than expected. For example, do not show a user's balance in your own app if the balance permission is not available.

Body parameters:

Return Messages and HTTP codes:

Body Example:

{
"key": "d7e60d03-5121-4d37-926e-daaa9a1ef5ca",
"discordid": "85405022041071626"
}

Response Example:

{
	"msg": "User Permissions retrieved",
	"data": {
		"permissions": [
			{
				"type": "balance",
				"value": false
			},
			{
				"type": "decrement",
				"value": false
			},
			{
				"type": "increment",
				"value": false
			}
		]
	}
}

POST /api/royale/incrementVP

Description: Give user Victory Points. Uses ROY from your API Balance at the current VP:ROY conversion rate. Only possible if your API has been given the skin AND increment permissions by the user.

Body parameters:

Return Messages and HTTP codes:

Body Example:

{
"key": "d7e60d03-5121-4d37-926e-daaa9a1ef5ca",
"amount": 100,
"discordid": "85405022041071626",
"skin": "cherry",
"enemies": 4000,
}

POST /api/royale/userequippedskin

Description: Check which skin a user has currently equipped. Only possible if your API has been given the skin permission by the user.

Body parameters:

Return Messages and HTTP codes:

Body Example:

{
"key": "d7e60d03-5121-4d37-926e-daaa9a1ef5ca",
"discordid": "85405022041071626"
}