use case
Receipt generation
Every transaction gets a matching PDF receipt.
Ops teams live in receipts. Generate, compress, archive — and surface them on an authenticated page when the customer asks.
Operations used
/fill-form
Line items + totals + tax
/watermark
REFUNDED or DUPLICATE stamps
/compress
Keep archive costs low
/metadata
Transaction ID tag
Example workflow
- 01Stripe payment_intent.succeededTrigger on success.
- 02SnapPDF fill-formPopulate receipt template.
- 03SnapPDF compressShrink for archive.
- 04Upload to S3Indexed by txn id.
Code
const filled = await snap.pdf.fillForm({
file: receiptTemplate,
values: {
txn_id: intent.id,
amount: formatMoney(intent.amount, intent.currency),
date: new Date(intent.created * 1000).toISOString(),
items: JSON.stringify(intent.metadata.line_items),
},
flatten: true,
});
const small = await snap.pdf.compress({ file: filled.pdf, level: 'high', stripMetadata: true });Best for
SaaS billingMarketplacesPoint-of-sale