monetization.requestEnableBillableAction
This API is only available to apps that have been accepted into the Premium Apps Program(opens in a new tab or window).
Prompts the user to enable access to a billable action.
Use this method when a user without premium access requests a premium feature.
If the action is already enabled, the method will resolve with a granted status, allowing the app to proceed.
Otherwise, the user will be prompted to enable access.
Usage: Prompt the user to enable premium access
import { auth } from '@canva/user';const response = await auth.monetization.requestEnableBillableAction('MY_BILLABLE_ACTION');if (response === 'granted') {// User has access, proceed with premium featureconst session = await auth.monetization.openTrackingSession({action: 'MY_BILLABLE_ACTION'});} else {// User declined access, show alternative content}
Parameters
actionBillableActionThe BillableAction that triggered the request.
Available values:
"modify_image""modify_video""modify_audio""modify_text""import_image""import_video""import_audio""import_text""generate_image""generate_video""generate_audio""generate_text"
Returns
A promise that resolves with an EnableBillableActionResponse:
granted: if the action is enabled or the user successfully enables it.denied: if the user refuses to enable access. This is aPromisethat resolves with the following object:
Represents the result when a user successfully enables a billable action.
statusstringThe status indicating that the billable action was successfully enabled.
The only valid value is "granted".
Represents the result when a user is denied access to a billable action.
statusstringThe status indicating that the billable action was denied.
The only valid value is "denied".