Xsolla-logo

Create order with specified itemClient-side

post/v2/project/{project_id}/payment/item/{item_sku}

Used for client-to-server integration. Creates an order with a specified item and generates a payment token for it. The created order gets the new order status.

The client IP is used to determine the user’s country, which is then used to apply the corresponding currency and available payment methods for the order.

To open the payment UI in a new window, use the following link: https://secure.xsolla.com/paystation4/?token={token}, where {token} is the received token.

For testing purposes, use this URL: https://sandbox-secure.xsolla.com/paystation4/?token={token}.

Notice

As this method uses the IP to determine the user’s country and select a currency for the order, it is important to only use this method from the client side and not from the server side. Using this method from the server side may cause incorrect currency determination and affect payment methods in Pay Station.
SecurityXsollaLoginUserJWT
Request
path Parameters
project_id
required
integer

Project ID. You can find this parameter in your Publisher Account next to the name of the project.

Example: 44056
item_sku
required
string

Item SKU.

Example: booster_mega_1
Request Body schema: application/json
currency
string

Order price currency. Three-letter currency code per ISO 4217. Check the documentation for detailed information about currencies supported by Xsolla.

locale
string

Response language.

sandbox
boolean
Default: false

Creates an order in the sandbox mode. The option is available for those users who are specified in the list of company users.

quantity
integer >= 1
Default: 1

Item quantity.

promo_code
string

Redeems a code of a promo code promotion with payment.

object

Settings for configuring payment process and the payment UI for a user.

object

Interface settings.

theme
string
Default: "63295a9a2e47fab76f7708e1"

Payment UI theme. Can be 63295a9a2e47fab76f7708e1 for the light theme (default) or 63295aab2e47fab76f7708e3 for the dark theme. You can also create a custom theme and pass its ID in this parameter.

Enum: "63295a9a2e47fab76f7708e1" "63295aab2e47fab76f7708e3"
object

Interface settings for the desktop version.

object

Header settings.

is_visible
boolean

Whether to show the header in the payment UI.

visible_logo
boolean

If true, the logo is displayed in the header. To upload the image, open your project in Publisher Account and go to the Pay Station > Settings section.

visible_name
boolean

Whether to show the project name in the header.

visible_purchase
boolean
Default: true

Whether to show the purchase description (purchase.description.value) in the header. true by default.

type
string
Default: "normal"

How to show the header. Can be compact (hides project name and user ID) or normal (default).

Enum: "compact" "normal"
close_button
boolean
Default: false

Whether to show a Close button in desktop payment UI. The button closes the payment UI and redirects the user to the URL specified in the settings.return_url parameter. false by default.

mode
string

Interface mode in payment UI. Can be user_account only. The header contains only the account navigation menu, and the user cannot select a product or make a payment. This mode is only available on the desktop.

Value: "user_account"
object

User account details.

object

My payment accounts submenu.

enable
required
boolean
Default: false

Whether to show the submenu. false by default.

object

Page My account.

enable
required
boolean
Default: false

Whether to show the submenu. false by default.

order
required
integer >= 1

Position of the submenu in the menu.

object

Manage subscriptions submenu.

enable
required
boolean
Default: false

Whether to show the submenu. false by default.

order
required
integer >= 1

Position of the submenu in the menu.

object
visible_virtual_currency_balance
boolean
Default: true

Whether or not this element can be hidden on Payment UI.

object
object
close_button
boolean
Default: false

Whether to show a Close button in mobile payment UI. The button closes the payment UI and redirects the user to the URL specified in the settings.return_url parameter.

is_prevent_external_link_open
boolean
Default: false

Whether or not redirecting links to an external resource is disabled. When clicking an external link, the external-link-open event is sent via the postMessage mechanism. The address for the redirected link is passed in the url parameter.

is_payment_methods_list_mode
boolean
Default: false

Whether the list of payment methods available in the user’s country is displayed when opening the payment UI. If false (default), the payment method passed in the settings.payment_method parameter or the method selected by the PayRank algorithm is displayed.

is_independent_windows
boolean
Default: false

Whether to redirect users from the embedded launcher’s browser (WebView) to their default browser to make a purchase.

currency_format
string

Set to code to display a three-letter ISO 4217 currency code in the payment UI. The currency symbol is displayed instead of the three-letter currency code by default.

is_show_close_widget_warning
boolean
Default: true

Whether to show a warning about processing the transaction when hovering over the × icon before closing the payment page. If false is passed, or the parameter is not passed, the warning is not displayed.

layout
string

Location of the main elements of the payment UI. You can open the payment UI inside your game and/or swap the columns with information about an order and payment methods. Refer to the customization instructions for detailed information.

Enum: "embed" "column_reverse" "embed_column_reverse"
is_three_ds_independent_windows
boolean
Default: false

Whether to open the 3-D Secure check in a new browser window. Pass true if you use the Content Security Policy (CSP).

is_cart_open_by_default
boolean
Default: false

The display of the list of items in the cart when opening the mobile version of the payment UI. If true, the list is displayed in an extended view. If false (default) or the parameters is not passed, the list is displayed in a collapsed view.

payment_method
integer >= 1

Payment method ID.

return_url
string <uri> <= 1000 characters

Page to redirect the user to after payment. Parameters user_id, foreigninvoice, invoice_id and status will be automatically added to the link.

object
redirect_conditions
string

Payment status triggering user redirect to the return URL.

Enum: "none" "successful" "successful_or_canceled" "any"
delay
integer

Delay after which the user will be automatically redirected to the return URL.

status_for_manual_redirection
string

Payment status triggering the display of a button clicking which redirects the user to the return URL.

Enum: "none" "vc" "successful" "successful_or_canceled" "any"
redirect_button_caption
string

Localized redirect button captions.

custom_parameters
object [ 1 .. 200 ] properties

Project specific parameters.

Responses
200

Order was successfully created.

404

Item or coupon not found. Make sure the used data is correct.

422

Invalid error.

Request samples
application/json
{
  • "sandbox": true,
  • "quantity": 5,
  • "promo_code": "discount_code",
  • "settings": {
    },
  • "custom_parameters": {
    }
}
Response samples
application/json
{
  • "order_id": 641,
  • "token": "f4puMEFFDZcx9nv5HoNHIkPe9qghvBQo"
}