Regenerate a Receipt

   Journey Manager (JM) The transaction engine for the platform.  |    System Manager / DevOps  |  24.04This feature was updated in 24.04

Journey Manager allows you to re-generate a receipt after it has been generated and stored in a database, either with the Azure or AWS Storage services, by using the ReceiptSvc Fluent API methods. The receipt generation is a background process, and it may take some time to execute, so you can't assume that the receipt will be generated immediately.

You can set the receipt status to Ready, so the receipt generation background process will start and create the receipt. This is shown below:

new TxnUpdater(param.txn)
   .setReceiptStatusReady()
   .update()

To obtain at the generated receipt (as an array of bytes), you should use the following code:

Txn updatedTxn = new TxnQuery()
   .setId(submission_oid)
   .withReceiptPdf()
   .firstValue()
				
byte[] receiptBytes = new ReceiptSvc()
   .setTxn(updatedTxn)
   .renderReceipt();

If you use Azure Submission Data Storage service to store receipts in a database, you need to select the Overwrite Receipt On Upload checkbox ( overwriteReceiptOnUpload(true)) to allow receipt overwrite. If this is not set, an error will be thrown.

To simplify the process and make it generic, you can use the setForceUpdate(boolean) method to regenerate a receipt for either type of storage services. The method takes a Boolean value, which you use to retrieve a previous rendered receipt (false), or a new receipt with the newly added form data (true). |  24.04 This feature was introduced in 24.04

The typical example is shown below:

...
byte[] receiptBytes = new ReceiptSvc()
   .setTxn(updatedTxn)
   .setForceUpdate(true);
Tip

You can use the Receipt Generator service to generate (and regenerate) a receipt on demand.

Next, learn how to configure receipts server node.