SnapPDFSnapPDF
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

Example workflow

  1. 01
    Stripe payment_intent.succeeded
    Trigger on success.
  2. 02
    SnapPDF fill-form
    Populate receipt template.
  3. 03
    SnapPDF compress
    Shrink for archive.
  4. 04
    Upload to S3
    Indexed 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

Other use cases