TikTok for Developers

Developer Docs

Last updated November 13, 2026

In-App Purchases

The In-App Purchase APIs enable players to buy virtual goods, check balances, recharge coins, and navigate to the balance management page.

TT.Pay(param)

Opens the payment sheet for an order your server created. Before calling this method, create the order on your server with the create order API and pass the returned trade_order_id to the client.

Signature

public static void Pay(TTPayParam param)

Caution: The success callback doesn't confirm payment and doesn't authorize delivery. Deliver items only after your server confirms the order through the payment webhook or the query order API.

Parameters

Field

Type

Description

Required

trade_order_id

string

The trade order ID returned by your server's create order request.

Yes

success

Action<GeneralCallbackResult>

Called when the payment call succeeds.

No

fail

Action<ErrorInfo>

Called when the payment call fails.

No

complete

Action<GeneralCallbackResult>

Called after success or fail.

No

Example

TT.Pay(new TTPayParam
{
  trade_order_id = tradeOrderId,
  success = result =>
  {
    // Ask your server for the order status before delivering items
  },
  fail = error =>
  {
    // Handle payment failure
  }
});

TT.NavigateToBalance(param)

Opens the balance management page where the user can view and manage their coin balance.

Signature

public static void NavigateToBalance(NavigateToBalanceParam param)

Parameters

Field

Type

Description

Required

Success

Action

Success callback

No

Fail

Action<ErrorInfo>

Failure callback

No

Complete

Action

Completion callback

No

Example

TT.NavigateToBalance(new NavigateToBalanceParam
{
    Success = () => Debug.Log("Balance page opened"),
    Fail = error => Debug.LogError(error.ErrMsg),
    Complete = () => Debug.Log("Navigation completed")
});

TT.CheckBalance(param)

Queries the user's current coin balance.

Signature

public static void CheckBalance(CheckBalanceParam param)

Parameters

Field

Type

Description

Required

Success

Action<CheckBalanceResult>

Success callback with balance info

No

Fail

Action<ErrorInfo>

Failure callback

No

Complete

Action

Completion callback

No

Example

TT.CheckBalance(new CheckBalanceParam
{
    Success = result => Debug.Log($"Balance: {result.balance}"),
    Fail = error => Debug.LogError(error.ErrMsg),
    Complete = () => Debug.Log("Balance check completed")
});

TT.Recharge(param)

Initiates a coin recharge flow. The player will see a recharge dialog for the specified amount.

Signature

public static void Recharge(RechargeParam param)

Parameters

Field

Type

Description

Required

mode

string

Recharge mode

Yes

env

int

Environment (0 for production, 1 for sandbox)

Yes

currency

string

Currency type

No

platform

string

Payment platform

No

buyQuantity

int

Quantity to recharge

No

zoneId

string

Zone ID

No

customId

string

Custom order ID

No

extraInfo

string

Additional order info in JSON

No

Success

Action<RechargeResult>

Success callback

No

Fail

Action<ErrorInfo>

Failure callback

No

Complete

Action

Completion callback

No

Example

TT.Recharge(new RechargeParam
{
    mode = "gamecoin",
    env = 0,
    currency = "diamond",
    platform = "android",
    buyQuantity = 50,
    Success = result => Debug.Log("Recharge succeeded"),
    Fail = error => Debug.LogError(error.ErrMsg),
    Complete = () => Debug.Log("Recharge flow completed")
});
TikTok for Developers