In-App Purchases
Manages in-game currency operations including balance checks, top-ups, payments, and navigation to the balance page, enabling monetization through TikTok Beans.
TTMinis.game.checkBalance(opts)
Warning: Deprecated. Use TTMinis.game.pay instead.
Checks whether the current Beans balance is sufficient.
Parameters
Field | Type | Description | Required |
|
| The amount to check | Yes |
|
| The currency type. Currently only | Yes |
|
| The callback function called when the API call succeeds | No |
|
| The callback function called when the API call fails | No |
|
| The callback function called when the API call ends, regardless of success or failure | No |
Success callback parameters
Field | Type | Description |
|
| Whether the balance is sufficient for the requested amount |
Example
TTMinis.game.checkBalance({
amount: 50,
type: 'BEANS',
success: (result) => {
let isSufficient = result.is_sufficient;
},
fail: (error) => {
// Handle error
},
complete: () => {
// Triggered for both success and failure
}
})TTMinis.game.recharge(opts)
Warning: Deprecated. Use TTMinis.game.pay instead.
Recharges Beans.
Parameters
Field | Type | Description | Required |
|
| The recharge tier ID | Yes |
|
| The callback function called when the API call succeeds | No |
|
| The callback function called when the API call fails | No |
|
| The callback function called when the API call ends, regardless of success or failure | No |
Example
TTMinis.game.recharge({
tier_id: 'YOUR_TIER_ID',
success: () => {
// Handle success
},
fail: (error) => {
// Handle error
},
complete: () => {
// Triggered for both success and failure
}
})TTMinis.game.pay(opts)
Initiates a payment.
Parameters
Field | Type | Description | Required |
|
| The payment order ID | Yes |
|
| The callback function called when the API call succeeds | No |
|
| The callback function called when the API call fails | No |
|
| The callback function called when the API call ends, regardless of success or failure | No |
Example
TTMinis.game.pay({
trade_order_id: 'YOUR_TRADE_ORDER_ID',
success: () => {
// Handle success
},
fail: (error) => {
// Handle error
},
complete: () => {
// Triggered for both success and failure
}
})TTMinis.game.navigateToBalance(opts)
Navigates to the TikTok user Balance details page.
Parameters
Field | Type | Description | Required |
|
| The currency type. Currently only | Yes |
|
| The callback function called when the API call succeeds | No |
|
| The callback function called when the API call fails | No |
|
| The callback function called when the API call ends, regardless of success or failure | No |
Example
TTMinis.game.navigateToBalance({
type: 'BEANS',
success: () => {
// Handle success
},
fail: (error) => {
// Handle error
},
complete: () => {
// Triggered for both success and failure
}
})Error codes
errorCode | subErrorCode | Description |
| Environment check failed: App Store or Google Play connection failed | |
| Environment check failed: Timeout | |
| Environment check failed: Device not supported | |
| Environment check failed: Device not supported | |
| IAP payment: Failed | |
| Order consumption query: Server returned incorrect order status | |
| IAP payment: Canceled | |
| IAP payment: Pending | |
| User closed the payment panel | |
| User tapped the product repeatedly; the third party called the JSB multiple times | |
| Network error | |
| Order consumption query: API network failure | |
| Balance check: API network failure | |
| Recommended tier retrieval: API network failure | |
| Beans consumption: API network failure | |
| Subscription list query: API network failure | |
| Subscription cancellation: API network failure | |
| System error | |
| Tier info error | |
| Failed to open the payment panel | |
| Order query timeout | |
| Server returned an incorrect status code | |
Other | Server-side error |