Use an authenticated Canva profile to identify or open a paid subscription invoice, download its original PDF, and verify that the result is a PDF with basic file and metadata checks. Read only download metadata and standard PDF properties; never expose invoice text, credentials, payment data, authentication tokens, or raw PDF bytes.
Use Cases
Use when the caller asks to download a Canva subscription invoice and verify the resulting PDF. The caller may provide an invoice URL or invoice ID; otherwise resolve the newest paid subscription invoice from purchase history. The caller must already have an authenticated Canva profile. Stop and report an authentication error if a login page appears. This skill does not enter payment details, modify subscriptions, or initiate purchases.
Automation Flow
- Use the authenticated Browserless Cloud Canva profile. If an invoice ID is supplied, navigate directly to
https://www.canva.com/invoices/{invoice-id}. If no ID is supplied, navigate directly tohttps://www.canva.com/settings/purchase-historyand run the evaluator below to resolve the newest paid subscription invoice. Never guess an opaque invoice ID. - Wait for the target page to render. Dismiss only a clearly identified cookie-consent or informational dialog. Stop for login, CAPTCHA, security-warning, account-verification, or ambiguous dialogs.
- For purchase history, choose the candidate marked paid/completed and associated with subscription or plan context, preferring the explicit newest date. Read the opaque ID from the invoice anchor URL. If
selectedisnull, stop and report that no paid subscription invoice was found; do not pick another invoice. - Prefer the authenticated original-PDF endpoint:
https://www.canva.com/_ajax/billing/async/invoice/{encoded-invoice-id}/download?body.request.invoice={encoded-invoice-id}. In Playwright, capture the response or download while requesting this URL with the authenticated browser context. Do not expose request headers, cookies, or tokens. - If the endpoint does not produce a PDF download, open
https://www.canva.com/invoices/{invoice-id}and activate only a clearly labeled invoice-download control once. Do not click a generic unlabeled button. The invoice detail route is a stable fallback, but the observed resource inspection showed that invoice/download/PDF requests may be initiated by the detail page, so verify the resulting response or download rather than relying on visible page text. - Save the download only to a temporary local path controlled by the script. Require a Playwright download record or a successful response with a PDF content type and a filename ending in
.pdf. Reject HTML, screenshots, or printed webpages. - Read the temporary file only for verification. Return file size, filename, PDF version,
%PDF-signature status, an end-of-file marker or parse-status check, and selected standard metadata fields such as title, author, creator, producer, creation date, and modification date when present. Never return invoice text, page text, raw bytes, URLs containing credentials, cookies, authorization headers, or the PDF itself. - Delete the temporary file after verification when the caller does not explicitly request retention. Report the invoice ID, invoice URL, download filename or endpoint, and verification result. Do not claim payment approval or reuse approval from another run.
Purchase-history evaluator:
(() => {
const clean = s => (s || '').replace(/\s+/g, ' ').trim();
const parseDate = text => {
const value = clean(text);
const match = value.match(/\b(?:20\d{2}[-/]\d{1,2}[-/]\d{1,2}|\d{1,2}[-/]\d{1,2}[-/]20\d{2}|(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*\s+\d{1,2},?\s+20\d{2})\b/i);
const timestamp = match ? Date.parse(match[0]) : NaN;
return { dateText: match ? match[0] : null, timestamp: Number.isFinite(timestamp) ? timestamp : null };
};
const bodyText = clean(document.body?.innerText);
const loginDetected = /\b(?:log in|login|sign in|sign up)\b/i.test(document.title + ' ' + bodyText) && !/purchase history|orders and invoices/i.test(bodyText);
const candidates = [...document.querySelectorAll('a[href*="/invoices/"]')].map((a, index) => {
const href = a.href || a.getAttribute('href') || '';
const idMatch = href.match(/\/invoices\/([^/?#]+)/i);
const row = a.closest('tr, [role="row"], li, [data-testid], section, article') || a.parentElement;
const rowText = clean(row?.innerText || a.innerText);
const parsed = parseDate(rowText);
return {
index,
invoiceId: idMatch ? decodeURIComponent(idMatch[1]) : null,
invoiceUrl: idMatch ? new URL(`/invoices/${idMatch[1]}`, location.origin).href : href,
label: clean(a.innerText || a.getAttribute('aria-label')),
rowText,
dateText: parsed.dateText,
timestamp: parsed.timestamp,
isPaid: /\bpaid\b|\bcomplete(?:d)?\b|\bprocessed\b/i.test(rowText),
isSubscription: /\b(?:subscription|plan|pro|teams?|enterprise|monthly|annual|yearly|renewal)\b/i.test(rowText)
};
}).filter(x => x.invoiceId);
const unique = [...new Map(candidates.map(x => [x.invoiceId, x])).values()];
const paidSubscriptions = unique.filter(x => x.isPaid && x.isSubscription);
const ordered = [...paidSubscriptions].sort((a, b) => (b.timestamp ?? -Infinity) - (a.timestamp ?? -Infinity) || a.index - b.index);
return {
url: location.href,
title: document.title,
loginDetected,
candidates: unique,
paidSubscriptions,
selected: ordered[0] || null,
mainText: clean(document.querySelector('main,[role="main"]')?.innerText),
blockingDialogs: [...document.querySelectorAll('[role="dialog"],[role="alertdialog"]')].map(x => clean(x.innerText)).filter(Boolean)
};
})()Node-side PDF verification helper for the Browserless Playwright script:
function verifyPdfBuffer(buffer) {
const bytes = Buffer.isBuffer(buffer) ? buffer : Buffer.from(buffer);
const head = bytes.subarray(0, 8).toString('latin1');
const tail = bytes.subarray(Math.max(0, bytes.length - 2048)).toString('latin1');
const readLiteral = key => {
const match = bytes.toString('latin1').match(new RegExp('/' + key + '\\s*\\(((?:\\\\.|[^()\\\\])*)\\)'));
return match ? match[1].replace(new RegExp(String.raw`\\([()\\])`, 'g'), '$1').slice(0, 256) : null;
};
return {
isPdf: /^%PDF-\d\.\d/.test(head),
signature: head.slice(0, 5) === '%PDF-',
version: (head.match(/^%PDF-(\d\.\d)/) || [])[1] || null,
byteLength: bytes.length,
hasEofMarker: /%%EOF\s*$/.test(tail),
hasTrailerOrXref: /(?:trailer|startxref)/.test(tail),
metadata: {
title: readLiteral('Title'),
author: readLiteral('Author'),
creator: readLiteral('Creator'),
producer: readLiteral('Producer'),
creationDate: readLiteral('CreationDate'),
modificationDate: readLiteral('ModDate')
}
};
}Possible Friction Points
- Canva purchase history is directly reachable at
/settings/purchase-history; no homepage navigation is needed. - Invoice detail links contain an opaque invoice ID under
/invoices/{invoice-id}. Resolve that ID from the purchase-history anchor or use the caller-supplied invoice URL; never fabricate it. - The original-PDF request uses the authenticated endpoint
/_ajax/billing/async/invoice/{invoice-id}/downloadwithbody.request.invoice={invoice-id}as a query parameter. URL-encode the ID. - Purchase-history rows can contain multiple invoice-like records. Require paid/completed status and subscription/plan context, and use the explicit date to determine newest.
- The page may show an authenticated purchase history while invoice downloads are handled as browser downloads, leaving a blank or minimal document. Verify response/download metadata rather than visible page text.
- Invoice detail pages may initiate invoice, download, or PDF resources after a download control is activated. Resource names alone are not proof of success; require the captured response/download and PDF signature checks.
- The invoice detail fallback must use a clearly labeled download control. Do not replay a generic
button[type='button']selector because its meaning can change. - Cookie or informational dialogs may block the page, but dismiss only an unambiguous consent/information dialog. Stop for login interruptions, CAPTCHA, security warnings, account-verification prompts, or ambiguous states.
- Standard PDF metadata may itself contain identifying text. Return only the requested metadata fields, truncate unusually long values, and never return page contents or raw PDF objects.
- Never request, expose, or persist payment credentials, PAN, CVC, expiry, wallet tokens, authentication secrets, cookies, authorization headers, or approval identifiers.
Example Result
{
"isPdf": true,
"signature": true,
"version": "1.7",
"byteLength": 1234,
"hasEofMarker": true,
"hasTrailerOrXref": true,
"metadata": {
"title": "Example Title",
"author": null,
"creator": null,
"producer": null,
"creationDate": null,
"modificationDate": null
}
}