This API aims to allow third-party applications to initiate one-on-one game sessions on the online gaming platform papergames.io.
In a nutshell, your server calls the API and retrieves an URL that can be embedded into an iframe to empower your application with online game sessions.
The endpoint POST /api/room/embedded
creates a room session and returns iframe URLs that can be used by your application to connect two remote players.
Please refer to the endpoints section for usage instructions.
Please refer to the pricing section to see our rates.
Quotas
The Requests
represent a single call to the API. If two players are connected and play 10 rounds of Tic-Tac-Toe, you’ll be charged for one game session.
The playUrl
field contains an embeddable URL that can be integrated into an iframe for a user to play.
The watchUrl
field contains an embeddable URL that can be integrated into an iframe for a user to watch the game as a spectator.
On your application, you should display to the players an iframe containing the playUrl
field as src
attribute along with the username.
When the iframe
is displayed on your FrontEnd, it automatically initiates a connection with papergames.io. The first player will have a message “Waiting for player”. The game session begins as soon as the iframe
is displayed to the second player. The players can play together as many rounds as they want without creating extra charges.
URL to play
https://papergames.io/en/r/{roomUid}/embed/play?username=John Doe
The parameter username
needs to be provided as GET
parameter in the iframe
src
attribute to set the payer’s name.
URL to spectate
https://papergames.io/en/r/{roomUid}/embed
You can use our sample codepen to test the result of this API:
https://codepen.io/gazeau/pen/PoQvbPz
Important: to emulate the second player, you must open the codepen on a private navigation window.