Generate PDF receipt after the order has been placed

In this example, we place an order, read it back with full pricing data and assemble a printable receipt that can be rendered as a PDF on the client.

βœ… Purpose of the scenario:
  • Place an order and read it back with Orders.getOrderByMarkerAndId()
  • Assemble a receipt from the order's products, totals and payment method
  • Render the receipt as a downloadable PDF on the client
βœ… What you need:
  • A valid PROJECT_URL and APP_TOKEN for authentication with the OneEntry API.
  • Registered user
  • Configured order storage with marker "orders"
πŸ“Œ Important:
  • PDF rendering is not part of the OneEntry SDK β€” use any client-side library (jsPDF is shown here). The SDK only provides the order data.
  • totalSum comes back as a string and currency is often empty β€” format with Number(totalSum).toFixed(2) and never hardcode a currency symbol.
  • These examples do not include error handling.
  • You can manage errors using a try-catch block or by employing a construction like await Promise.catch((error) => error).
πŸ“š See in documentation:
πŸ“¦ SDK reference:
Loading sandbox…