Redirects configuration

Overview

To redirect users to another page after they completed the payment, you can configure redirects in Publisher Account or via API. For different payment statuses (successful or cancelled payment) you can configure the following redirects:

  • automatic — a redirect in a set delay time.
  • manual — a redirect after a user clicks the redirect button.

You can simultaneously configure automatic and manual redirects. A user will still have a possibility to click the redirect button to return to the application. Otherwise, they will be automatically redirected when the set delay time is over.

Notice
Limitations:
  • Redirect configurations passed via API take priority over the ones set in Publisher Account.
  • Automatic redirect configurations take priority over the ones set for manual redirects. For example, if both the manual redirect and the automatic redirect with the delay time of 0 seconds are configured for successful payments, the automatic redirect will take place.
The following GET-parameters are automatically added to the the URL where a user is redirect to:
  • user_id — user ID.
  • foreigninvoice — transaction ID passed in the external_id parameter.
  • invoice_id — transaction ID.
  • status — transaction status. It can have the following values:
Transaction statusDescription
doneThe payment is successfully completed.
invoiceThe invoice for the payment was generated.
deliveringThe payment is being processed on Xsolla side.
troubledAn error occurred when processing the payment or during the refund process.
full_changeThe payment was made with Xsolla balance.

Example of the URL where a user is redirected to: {Return URL}?user_id=[value]&foreignInvoice=[value]&invoice_id=[value]&status=done

If a user closes the payment UI tab before completing the payment, they are redirected to the specified redirect URL with the format of: {Return URL}?user_id=[value]&invoice_id=. If the payment UI opens with Pay Station Embed, then when closing the payment UI, the widget closes and the user returns to the game.

Configure automatic redirects

You can configure automatic redirects:

  • in Publisher Account
  • via API
  • Configure automatic redirects in Publisher Account

    1. Open your project in Publisher Account and go to Pay Station > Settings > Redirect policy.
    1. In the Return URL field, enter a URL address or a path (a deep link) a user is redirected to after making a payment. To improve user experience when a user opens the payment UI in a game mobile application, we recommend specifying a deep link as a return URL.
    2. In the drop-down list, choose Automatic redirect condition:
      • None — do not redirect.
      • Successful payment — redirect when a payment is successful.
      • Successful or canceled payment — redirect when a payment is successful or canceled.
      • Any payment — redirect for any payment status.
    3. In the Delay field, enter a redirect timeout in seconds. By default, a redirect is activated in 0 seconds.
    4. If you would like to configure only the automatic redirect without adding a redirect button, in the Manual redirect condition drop-down list, choose None — do not redirect.
    5. Click Save.

    Configure automatic redirects via API

    Note
    If you want to specify different redirect URLs, e.g., for different platforms, you need to create a dedicated token in each particular case.

    To configure redirects, pass the following data in the Create token API call:

    • settings.return_url — a URL address or a path (a deep link) a user is redirected to after making a payment. To improve user experience when a user opens the payment UI in a game mobile application, we recommend specifying a deep link as a return URL.
    • settings.redirect_policy.redirect_conditions — redirect conditions:
      • none — do not redirect.
      • successful — redirect when a payment is successful.
      • successful_or_canceled — redirect when a payment is successful or canceled.
      • any — redirect for any payment status.
    • settings.redirect_policy.delay — a timeout in seconds when a redirect to the URL passed in the settings.return_url parameter is activated. By default, a redirect is activated in 0 seconds.

    Configure manual redirects

    You can configure manual redirects:

    Notice
    Redirect configurations passed via API take priority over the ones set in Publisher Account.

    Configure manual redirects in Publisher Account

    1. Open your project in Publisher Account and go to Pay Station > Settings > Redirect policy.
    1. In the Return URL field, enter a URL address or a path (a deep link) a user is redirected to after making a payment. To improve user experience when a user opens the payment UI in a game mobile application, we recommend specifying a deep link as a return URL.
    2. If you would like to configure only the manual redirect, in the Automatic redirect condition drop-down list, choose None — do not redirect.
    3. Leave the Delay field empty.
    4. In the Manual redirect condition drop-down list, choose a payment status when the redirect button appears:
      • None — do not redirect.
      • Successful payment — redirect when a payment is successful.
      • Successful or canceled payment — redirect when a payment is successful or canceled.
      • Any payment — redirect for any payment status.
    5. In the Redirect button caption field, enter the copy for the button that will redirect a user to the return URL.
    6. Click Save.
    Notice

    By default, the redirect button copy is Back to the Game. It is localized into all Pay Station languages.

    If your project supports several languages, you can enter redirect button copy for each of them in the respective fields.

    When a user closes the payment UI, they are also redirected to the specified return URL.

    Configure manual redirects via API

    Note
    If you want to specify different redirect URLs, e.g., for different platforms, you need to create a dedicated token in each particular case.

    To configure redirects, pass the following data in the Create token API call:

    • settings.return_url — a URL address or a path (a deep link) a user is redirected to after making a payment. To improve user experience when a user opens the payment UI in a game mobile application, we recommend specifying a deep link as a return URL.
    • settings.redirect_policy.manual_redirection_action — the payment UI behavior triggered by the user clicking the close button or the return button:
      • redirect (by default) — a user is redirected to the return URL.
      • postmessage — clicking the close icon initiates sending the close-widget event, and clicking the return button — the return event. In this case, a user isn’t redirected to the return URL. You need to configure processing of events for closing the payment UI or redirection. This setting is only available when using API.
    • settings.redirect_policy.redirect_button_caption — a copy for the button that will redirect a user to the return URL.
    • settings.redirect_policy.status_for_manual_redirection — a payment status when the redirect button appears:
      • none — do not redirect.
      • successful — redirect when a payment is successful.
      • successful_or_canceled — redirect when a payment is successful or canceled.
      • any — redirect for any payment status.

    Notice
    If the payment UI is opened in an iframe and the settings.ui.desktop.header.close_button parameter is set to true, only the postmessage event is sent when a user clicks the close icon. It allows you to process the event and close the payment UI, and a user can stay at the page from which the payment was initiated.

    Example of redirect configuration

    In Publisher Account, you configured automatic redirects with a delay of 3 seconds. This behavior applies to both a mobile and desktop versions of the payment UI. The configurations set in Publisher Account look like this:

    If you need to update settings for opening the payment UI in the mobile application of your game, namely to add the redirect button and to specify a deep link as a return URL, you need to update settings passed in a token:

    ParameterValue
    settings.return_urlA deep link that redirects a user to a game application.
    settings.redirect_policy.redirect_conditionsany
    settings.redirect_policy.manual_redirection_actionredirect
    settings.redirect_policy.redirect_button_captionA copy for the redirect button.
    A request for getting a token will look like this:
    Copy
    Full screen
    Small screen
      {
          "user": {
              "country": {
                  "value": "US"
              },
              "id": {
                  "value": "1234abCd"
              },
              "name": {
                  "value": "John Smith"
              }
          },
          "settings": {
              "currency": "USD",
              "project_id": 123456,
              "language": "en",
              "return_url": "myapp://payment/successful",
              "ui": {
                  "desktop": {
                      "header": {
                          "visible_logo": true
                      }
                  }
              },
              "redirect_policy": {
                  "redirect_conditions": "any",
                  "redirect_button_caption": "Back to Store",
                  "manual_redirection_action": "redirect",
                  "status_for_manual_redirection": "any"
              },
              "external_id": "1a2b3c"
          },
          "custom_parameters": {
              "timestamp": 1234512345123,
              "sku": "testSKU",
              "amount": "10"
          },
          "purchase": {
              "virtual_items": {
                  "items": [
                      {
                          "sku": "testSKU",
                          "amount": 1
                      }
                  ]
              }
          }
      }
      
      Was this article helpful?
      Thank you!
      Is there anything we can improve? Message
      We’re sorry to hear that
      Please explain why this article wasn’t helpful to you. Message
      Thank you for your feedback!
      We’ll review your message and use it to help us improve your experience.
      Last updated: September 6, 2024

      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!