Skip to main content

What You’ll Build

An Invoice button on your own order history page. Your server looks up the payment through GraphQL, reads its invoiceToken, and builds a link. When the customer clicks it, the invoice opens in the browser, already authorized, with a Download PDF button. No sign-in, no email verification.
There is no endpoint that returns the PDF file itself. The PDF is generated in the customer’s browser on the invoice page. If you need the file on your server, open the link in a headless browser, or point your customers to the page.

Prerequisites

  • An API Key (Dashboard → API & Development). Use a test key while you build
  • The Waffo Payment ID (PAY_xxx) of the payment, or a way to find it: your own business number (orderMerchantExternalId), the buyer’s email, or the order ID
  • The payment must be succeeded. Pending and failed payments have no invoice

Step 1: Read the invoiceToken

Query payments (or payment by ID) and include invoiceToken. The field is visible to the merchant role only, so API Key and Dashboard sessions can read it; customer portal sessions cannot.
To list every invoice a customer can download, filter by the buyer’s email and status: succeeded:

Render it as a link or button on your order page. Anyone holding the link can open that one invoice and download the PDF; the token does not grant access to anything else.

Step 3: Keep It Current

The token is stable for the life of the payment, so you can store it next to your order record. Two convenient moments to fetch it:
  • On webhook: order.completed and subscription.payment_succeeded carry the Payment ID as eventId. Query payment(id:) for the invoiceToken and save it with the order. See Webhooks
  • On demand: query payments by buyerEmail or orderMerchantExternalId when the customer opens their order history

What the Invoice Shows

Customers can also edit their invoice details (company name, address, tax ID) before downloading when they open the same invoice from the customer portal.

Alternatives


FAQ

The payment is not succeeded yet. Pending and failed payments never get a token. Check status first. A 0.00 card-verification payment that starts a free trial is succeeded and does get one.
Not through the API. The PDF is produced in the browser on the invoice page. Use the link as-is, or render the page in a headless browser if you must archive a copy.
No. It stays valid for the life of the payment, and refunds do not change it. The invoice page shows refunds that happen later.
Yes. Test payments get an invoiceToken too, and the link opens the invoice with a test-mode banner.