Store receipt data durably
Tie the project ID to the customer's source and quote. Avoid leaking private upload URLs into logs or user-visible error messages.
Attach the generated file later
When completion is confirmed, obtain the actual output, validate it and record the download separately. Treat any failure or credit return as its own state.
Example
A response can already record a charge for a queued operation while the file status remains pending.
Pass condition
The job is recoverable from the same ID and the customer sees a download only when the actual artifact is ready.