API reference
Design
addAudioTrackaddElementAtCursoraddElementAtPointaddNativeElementaddPagecreateRichtextRangeeditContentgetCurrentPageContextgetDefaultPageDimensionsgetDesignMetadatagetDesignTokeninitAppElementopenDesignoverlay.registerOnCanOpenrequestExportselection.registerOnChangesetCurrentPageBackgroundui.startDragToCursorui.startDragToPointui.startDrag
Intents: data
Intents: design
Platform
appProcessappProcess.broadcastMessageappProcess.currentappProcess.current.getInfoappProcess.current.requestCloseappProcess.current.setOnDisposeappProcess.requestCloseappProcess.registerOnMessageappProcess.registerOnStateChangefeatures.isSupportedfeatures.registerOnSupportChangegetPlatformInfonotification.addToastrequestOpenExternalUrl
getPlatformInfo
API reference for the getPlatformInfo method.
Returns information about the platform on which the app is running.
Usage
Get platform information
import { getPlatformInfo } from '@canva/platform';const platformInfo = await getPlatformInfo();
TYPESCRIPT
Check if app is running on platform that allows payments
import { getPlatformInfo } from '@canva/platform';const platformInfo = await getPlatformInfo();if (platformInfo.canAcceptPayments) {// Show payment-related UI elements} else {// Hide payment-related UI elements}
TYPESCRIPT
Returns
Information about the platform on which the app is running.
canAcceptPaymentsbooleanIf true, the app is allowed to directly link to payment and upgrade flows.
This property is always true when the app is running in a web browser, but may otherwise be false in
order to comply with the policies of the platforms on which Canva is available. For example, some platforms
only allow payment-related actions that use their own payment mechanisms and apps are therefore not allowed
to render payment-related call-to-actions while running on those platforms.
Example
const info = getPlatformInfo();if (info.canAcceptPayments) {// Display payment links and upgrade flows} else {// Hide payment links and upgrade flows// Optionally, show an appropriate message}
TS