Finalizes a draft invoice by ID. The invoice must be valid, not soft-deleted, and belong to the merchant account resolved from the secret key. Request body — autoAdvance: Optional. If omitted, treated as true. This controls the immediate finalize path only (when autoFinalizeAt is omitted): when true, Prolife Payments may open the invoice and schedule automatic collection according to the invoice collectionMethod. When false, the invoice is opened and numbered without scheduling automatic collection or recurring-engine follow-up (currentRecurringEngineProcess cleared). Request body — autoFinalizeAt: Optional. Unix timestamp (seconds) for when the recurring engine should run the finalize step. Cannot be used with autoAdvance = false. When autoFinalizeAt is provided, the platform does not apply the immediate autoAdvance = true finalize rules below (no open transition, no invoice number allocation, no nextPaymentAttempt / autoSendInvoiceAt / PAY_INVOICE / SEND_INVOICE from this call). It updates only these fields on the invoice (the invoice remains draft until the engine finalizes it): - autoAdvance = true - autoFinalizeAt = the Unix timestamp sent in the request - currentRecurringEngineProcess = FINALIZE_INVOICE - lastUpdated = current server time (NOW()) When autoFinalizeAt is omitted — autoAdvance = true (default): - collectionMethod = charge_automatically: autoAdvance = true, status = open, finalizedOn = now, autoFinalizeAt = null, invoiceNumber generated, nextPaymentAttempt set per platform automatic-collection policy, autoSendInvoiceAt = null, currentRecurringEngineProcess = PAY_INVOICE. - collectionMethod = send_invoice: autoAdvance = true, status = open, finalizedOn = now, autoFinalizeAt = null, nextPaymentAttempt = null, autoSendInvoiceAt set per platform invoice-send policy, invoiceNumber generated, currentRecurringEngineProcess = SEND_INVOICE. autoAdvance = false (only when autoFinalizeAt is omitted): autoAdvance = false, status = open, finalizedOn = now, autoFinalizeAt = null, nextPaymentAttempt = null, autoSendInvoiceAt = null, invoiceNumber generated, currentRecurringEngineProcess = null. Response data matches the invoice-by-id shape. Line-item price, accountDiscounts, and accountFees follow the same expand pattern as GET invoice when expand is supported.
post
https://api-dev.prolifepayments.com/onboard/v1/invoices//finalize

