Implementing Webshop

How to integrate a Pley webshop into your game-client and -backend? (3-4 hours of implementation)

📘

Webshop Early-Access

Pley Webshops are currently a early-access feature on our game sites. Features could be changed over time.
However, we aim to rarely make changes which affect the implementation.

API Reference & Examples

How to manage your webshop and products

After making a purchase, the user claims the purchase through a deep link.

After making a purchase, the user claims the purchase through a deep link.

📘

User Experience

  1. Player visits the webshop and clicks a product.
  2. Player signs up with email, Google, or Facebook.
  3. Player makes a purchase.
  4. Player clicks a button (mobile webshop) or scans the QR code (desktop webshop)
  5. Purchase complete and items granted!

For repeat purchases, no sign-in or QR code is necessary!

Implementation

The game can either claim a webshop purchase through a deep link (step 1) or simply by calling get-entitlements on startup if the user already has a pley_game_user_id (ref) saved in your database.

1) The player buys an item in the webshop, which then starts the game with a deep link, containing an entitlement_id. Requires player authentication to be completed.

2) The game provides that entitlement_id, to the game backend.

3) Game backend callsget-entitlement-info (ref) , providing the entitlement_id , which returns information about the webshop purchase (who bought it, buyer's email, and the list of bought products).

4) Return the products and email to the game client.

5) Game backend gains a pley_game_user_id for the user who made the purchase.
Verify that the pley_game_user_id isn't assigned to another user. (If so, error).

6) Show game UI with the email address to the user; asking to link the purchase with their game account and complete the purchase.

7) The player clicks "claim".

8) Backend saves the PleyUserID to the game account for future purchases.

9) Backend consumes the entitlement (using consume-entitlement, ref) and grants the items to the player.

10) The player sees the purchased item in the game!

📘

After the first purchase

For purchases after the first one, you do not need to prompt the player to claim the items. If PleyUserID for the purchase matches the PleyUserID linked with the game user, you know the purchase is legit and you should simply give them the items in a popup.

👍

That's it!

Get the API References with examples / explanations by clicking here.


Configuring Your Webshop

The webshop is managed by the Pley Game Manager, letting you customize:

  • Product names / visual assets
  • Availability
  • Deals (discounts, promotions, and limited availability)