Set up user validation

  1. In the Builder for your site, go to the Top-up block.
  2. In the Layout block, set the User ID instructions toggle to On and add steps and images to help users find their ID in a game.

  1. Set up the check that the user exists at the stage of entering the user ID (optional).
  2. Set up the check that the user exists at the stage of choosing a payment method.

Set up user validation at stage of entering user ID

  1. In the User ID input block, set the User ID validation toggle to On.

  1. Enter the URL to receive webhooks.

Note
Webhook URL has to start with https://. Using http:// will lead to an error.

  1. On the side of your application, implement handling of the user validation webhook. When receiving a webhook, the application should do the following:
    1. Search for a user by their ID passed in the webhook.
    2. Depending on the result, send one of the status codes:
      • 200 (with additional information) or 204 (without additional information) — if a user is found
      • 455 — if a user ID is not found

Copy
Full screen
Small screen
    "http_status_code": 200
    {
      "status": "success"
      "user": {
        "id": 1234567,
        "name": "Xsolla User",    
        "level": "80",
      }
    }

    Description of parameters for the 200 status code:

    ParameterDescription
    user.idUser ID. Required.
    user.nameUser name. If passed, it will be displayed instead of user.id.
    user.levelUser level.

    Set up user validation at stage of choosing payment method

    1. Configure parameters for receiving webhooks:
      1. Open your project in Publisher Account.
      2. Click Project settings in the side menu.
      3. Go to the Webhooks section.
      4. Set the Webhooks toggle to On.
      5. In the Webhook URL field, specify the URL to receive webhooks.
      6. A secret key to sign project webhooks is generated by default. If you want to generate a new secret key, click the refresh icon.
      7. Click Save settings.

    1. On the side of your application, implement handling of the user validation webhook.

    To confirm that the webhook is received, your server must respond with:

    • HTTP code 204 without a message body.
    • HTTP code 400 describing the problem if the specified user was not found or if an invalid signature was passed.

    Your progress
    Thank you for your feedback!

    Continue reading

    Last updated: December 28, 2021

    Found a typo or other text error? Select the text and press Ctrl+Enter.

    Report a problem
    We always review our content. Your feedback helps us improve it.
    Provide an email so we can follow up
    Thank you for your feedback!