100HP
  1. 100HP API for partners v2.9.1
100HP
  • 100HP API for partners v2.9.1
    • General
      • Overview
      • FAQ
        • Rollback and billing resolver general flow
        • HTTP status codes and custom error codes
        • IP Whitelisting
    • Integration
      • Preparation for integration
      • General API provision
    • 100HP Gaming API
      • Game list
      • Launch game url
      • Video replay
    • 100HP Game flow API
      • Player authorization
      • Get balance
      • Withdrawal money
      • Deposit money
      • Rollback money
    • Implementation Guide
      • YourCasino.js
      • Casino.js
      • TestCasino.js
      • DDL-example
        • mongodb.js
        • mysql.js
        • postgres.js
    • Testing
      • Automated Test Service
    • API INFO
      • API Changelog
  1. 100HP API for partners v2.9.1

Implementation Guide

100hp Casino Integration: Step-by-Step Guide#

This file is intended for developers who want to integrate the 100hp system into their project. It explains how to create your own casino class based on the provided SDK.

1. Create Your Casino Class#

You need to create a class that will handle all interactions with users and game sessions. To do this:
Create a new file, for example BestCasino.js.
Define a class BestCasino that extends the base Casino class Casino.js:
import Casino from './Casino.js';

export default class BestCasino extends Casino {
  // Your methods will go here
}
You can use file YourCasino.js as a start template

2. Export Your Class#

After creating your class, update the export in index.js to use your class:
import BestCasino from './BestCasino.js';

export default BestCasino;

3. Implement Class Methods#

The Casino class defines several methods that you must implement for the integration to work correctly.
All the methods are transparently consistent with 100hp documentation. You can check method signatures in Casino class.
In case you have to handle internal (node.js or db related) error just throw classic javascript Error or don't wrap code into try..catch block. It will be handled.
In case you want to throw 100hp specific error use this code as a reference:
throw {
      data: 'Optional',
      code: 604,
      message: 'Session not found',
    };

Core Methods#

getSession(sessionId)
Retrieves the game session data (e.g., userId and currency).
Note:
Return undefined if no session found.
getUser(userId)
Returns user information: name, status (active or blocked), type (real or test), and segments (e.g., ['vip']).
getBalance(userId, currency)
Returns the user's balance in the specified currency.

Balance Operation Methods (ACID)#

All make* methods are intended to modify the user's balance and must maintain consistency:
makeWithdrawal(userId, currency, amount, txId)
Deducts funds from the user's balance.
makeDeposit(userId, currency, amount, txId)
Adds funds to the user's balance.
makeDepositWithPromo(userId, currency, amount, txId, promoId)
Adds funds with a promotion applied.
makeRollback(userId, txId)
Rolls back a transaction — correctly adjusts the balance in case of cancellation.
Important:
All operations must modify the balance internally. This ensures transactional integrity and proper system behavior.

Additional Method#

liveness()
Checks the status of your casino or database. Used for monitoring and service availability.

4. Using Database Drivers#

For convenience, we provide ready-to-use drivers for the most popular databases:
MySQL
PostgreSQL
MongoDB
Use these drivers to store user, session, and balance information. This allows you to easily connect your implementation to a real database.

5. DDL Examples#

In the DDL-example folder, you will find examples of user session tables (game_sessions_100hp) for different databases. This helps you:
Understand the expected data structure.
Quickly create the required tables and collections in your database.

6. Development Recommendations#

1.
Use TestCasino as a template to test your logic in a safe environment.
2.
Maintain ACID semantics when modifying user balances.
3.
Validate input data and throw errors for invalid values.
4.
Add indexes and unique keys for user and session tables to improve performance.
By following these steps, you will have a fully working casino class, ready to integrate into your project and interact with the 100hp API.
Modified at 2026-01-28 14:20:10
Previous
Rollback money
Next
YourCasino.js
Built with