The Canva Button is only available for users in China. If your users aren't in China, you can't use the Canva Button. There are no plans to make the Canva Button available outside of China.

onDesignPublish

API reference for the JavaScript API's onDesignPublish method.

A function that runs when a user publishes a design.

Usage

api.createDesign({
design: {
type: "Poster",
},
onDesignPublish: (opts) => {
console.log(opts);
},
});
JAVASCRIPT

You can pass the onDesignPublish function into the createDesign and editDesign functions.

Parameters

Name
Type
Required
Description
opts
object
Yes
Parameters that Canva passes into the function.
opts.designId
string
Yes
The ID of the user's design.
opts.designTitle
string
Yes
The title of the user's design.
opts.exportUrl
string
Yes
The URL for downloading the user's design. This URL expires after 15 minutes. The URL is in the form https://export-download.canva.com/<export_file>. If you're using the China version of the SDK, the TLD is .cn instead of .com. You can take the necessary security measures to protect the URL from any malicious attacks.

Returns

void