Download Stripe invoice/receipt PDF
Input
hosted_invoice_url requiredA Stripe-related invoice URL from a vendor's list_invoices script -- any of: a Stripe hosted invoice page (invoice.stripe.com/i/...), an HTML receipt page with Download invoice/receipt links (e.g. pay.stripe.com/receipts/invoices/...), or a direct file URL that downloads immediately (pay.stripe.com/invoice/.../pdf, a presigned S3/Orb link). The script detects which shape it is from the page itself.
doc_type optionalWhich PDF to download: 'invoice' (the formal invoice, default) or 'receipt' (the payment receipt, only present once paid). For a direct-file-URL page there is only ever one document available -- requesting the one that isn't there fails loud rather than silently returning the wrong one mislabeled.
Default: "invoice"Output
doc_type requiredWhich document was downloaded: invoice or receipt.
filename requiredThe real suggested filename (e.g. Invoice-V1L1VMU8-0001.pdf or Receipt-2415-5423.pdf), taken from the file's Content-Disposition.
pdf_base64 requiredThe PDF file bytes, base64-encoded. Decode and write to a .pdf file at a location of your choosing (the script is sandboxed and cannot write to disk itself).
