Xsolla-logo

Charge with saved accountServer-side

post/projects/{project_id}/users/{user_id}/payments/{type}/{account_id}

Charges a user via a saved payment account.

Note

In sandbox mode, this API call works only with test cards that have no 3-D Secure function.

Notice

For the API call to work correctly, configure a timeout of 2 minutes.

SecuritybasicAuth
Request
path Parameters
project_id
required
integer

Project ID.

user_id
required
string

Unique user ID in the game stored on your side. Make sure you pass the existing user ID. In case an error occurs, refer to the answers to the FAQs.

type
required
string

Type of payment account.

Enum: Description
card

Bank cards.

amazon

Amazon Pay.

skrill

Skrill Digital Wallet.

paypal

PayPal.

toss

Toss Wallet.

alipayplus_cn

Alipay.

alipayplus_hk

Alipay (Hong Kong).

alipayplus_gcash

GCash.

alipayplus_dana

DANA.

alipayplus_rabbitlinepay

Rabbit LINE pay.

alipayplus_tng

Touch 'n Go.

alipayplus_boost

Boost.

alipayplus_truemoney

TrueMoney Wallet.

alipayplus_maya

Maya.

softbank_paypay

PayPay.

softbank_docomo

Docomo.

softbank_softbank2

SoftBank.

softbank_au

au Easy Payment.

softbank_ymobile

Y!mobile.

paysafecard_eu

Paysafecard (EU).

paysafecard_us

Paysafecard (US).

klarna

Klarna. Payment account saving is available only for US, UK, Sweden, Germany, Austria, Norway, Finland, Denmark, Netherlands.

mercadopago

Mercado Pago.

account_id
required
integer

ID of the saved account in Xsolla database.

Request Body schema: application/json
object

User details.

ip
required
string

User IP address.

name
string

Username.

object

Object with legal entity details.

name
string

Full legal name.

address
string

Full legal address.

vat_id
string

Individual taxpayer identifier.

country
string

Country of incorporation. Two-letter uppercase country code per ISO 3166-1 alpha-2 is used.

object

Object containing purchase settings.

currency
string

Preferred payment currency. Three-letter currency code per ISO 4217.

external_id
string

Transaction ID in the game. Has to be unique for each user payment. Refer to documentation for detailed information.

mode
string

Set to sandbox to test out the payment process. Remove the parameter for real payments.

mock_code
integer

An error code that you want to reproduce when testing the payment process via PayPal in sandbox mode. It works correctly only if you pass the "mode":"sandbox" parameter.

Enum: 1057 1015 3006 1801 1803 1039 3031 1203 3006 1201 1002 1089 2031 1046 5004
object

Object containing purchase details.

object <= 4000 characters
value
string
object

Object containing virtual currency details.

quantity
number <float>

Purchase amount in the virtual currency.

object

Object containing checkout details.

currency
string

Currency of the purchase. Three-letter currency code per ISO 4217.

amount
number <float>

Purchase amount.

object

This object contains parameters to configure anti-fraud filters. The list of parameters is shown below. To add custom parameters, contact your Customer Success Manager or email at csm@xsolla.com.

registration_date
string

Account creation date per ISO 8601.

total_hours
integer

Total number of in-game hours.

total_characters
integer

Number of in-game characters.

social_networks_added
boolean

Whether the player has connected social media profiles.

profile_image_added
boolean

Whether the player has uploaded a profile image.

active_date
string

Last seen date per ISO 8601.

total_friends
integer

Number of friends.

additional_verification
boolean

Whether the player uses account verification procedures.

win_rate
integer

Win rate.

last_change_password_date
string

Last password change date per ISO 8601.

chat_activity
boolean

Whether the player uses the chat function.

forum_activity
boolean

Whether the player uses the forum function.

total_bans
integer

Number of times the player was banned in the chat/forum.

profile_completed
boolean

Whether the player added additional information to their profile.

notifications_enabled
boolean

Whether the player enabled notifications.

user_level
integer

Player’s level, reputation, or rank.

karma_points
integer

Player’s karma.

total_sum
number <float>

Total amount of payments.

non_premium_currency
number <float>

Amount of non-premium currency.

total_game_events
integer

Number of in-game events the player took part in.

total_gifts
integer

Number of in-game gifts the player has sent/received.

tutorial_completed
boolean

Whether the player has completed the game’s tutorial.

completed_tasks
integer

Number of tasks/objectives completed.

items_used
boolean

Whether the player uses purchased in-game items.

pvp_activity
boolean

Whether the player takes part in PvP (Player(s) versus player(s)) battles.

total_clans
integer

Number of clans the player is a member of.

unlocked_achievements
integer

Number of achievements unlocked.

total_inventory_value
number <float>

Total inventory value (in-game currency).

character_customized
boolean

Whether the player has customized their character.

session_time
string

Average session time per ISO 8601.

Responses
201

Created.

422

Unprocessable Entity.

Request samples
application/json
{
  • "purchase": {
    },
  • "settings": {
    },
  • "user": {
    }
}
Response samples
application/json
{
  • "transaction_id": 123458390
}