Pre-Payment Scenarios
Combining JustOn Billing & Invoice Management with JustOn Cash Management allows for handling pre-payments in integrations with sales portals or web shops.
For information about handling pre-payments in JustOn Billing & Invoice Management only, see Pre-Payment Balances.
Info
For the purpose of this article, assume that the sales transaction data from the sales portal or web shop is saved to dedicated custom Salesforce records (sales orders).
Depending on your individual business requirements, you can use other objects to hold the relevant data, like the standard Salesforce orders and order products.
The following initial scenarios are possible:
- Entry-first approach
-
The sales portal integration creates entries based on sales order data. As buyers pay, the entries are settled using the corresponding payments.
Now creating and finalizing invoices (based on the same sales order data) must relate the invoices with the existing entries, and associate the existing payments to the invoices to set them
Paid
.For details on this scenario, see Pre-Paid Entry Assignment on Invoice Finalization.
- Payment-first approach
-
The sales portal integration creates payments. Creating (and finalizing) invoices from the sales order data must relate the produced entries with the existing payments, settling them, and associate the existing payments to the invoices to set them
Paid
.For details on this scenario, see Payment Assignment on Invoice Finalization.
Pre-Paid Entry Assignment on Invoice Finalization
Assume your sales portal integration creates entries based on sales order data. You use JustOn Cash Management's payment functionality to collect the due payments or to invite your buyers pay. Consequently, the entries are settled using the corresponding payments.
Now creating and finalizing invoices – based on the same sales order data – must both relate the invoices with the existing entries, and associate the existing payments to the invoices in order to set the invoices Paid
.
Based on the sales order data, the sales portal integration uses the API or import processes to create
- an entry to anchor the downstream payment process to it, and
- a record to hold the sales order data.
The two records must include the same unique key to be used to to assign the entry to the (future) invoice.
Depending on your requirements, you can now expose JustOn Cash Management's payment page to invite your buyers to pay, or use the payment run to actively collect the due payment.
Once the payment is collected, the settlement takes place, assigning the payment to the open entry. This sets the entry to Balanced
. At the same time, the integration with JustOn Billing & Invoice Management creates a balance (of the type Payment
), which is associated to the account.
In JustOn Billing & Invoice Management, you have the generic invoice run create invoices from the record that holds the sales order data. This copies the unique key from your sales order data record to the field Entry Assignment Key
on the invoice.
On invoice finalization,
- the batch process BatchCreateEntries relates the entry created before with the new invoice using the unique key (comparing
Entry.AssignmentKey
withInvoice.EntryAssignmentKey
), and - the batch process BatchAssignBalances associates the "free" payment balance on the account with the new invoice to set it
Paid
.
Payment Assignment on Invoice Finalization
In another feasible scenario, your sales portal integration produces payments in JustOn Cash Management. Then, you use JustOn Billing & Invoice Management to create invoices based on the sales order data. Finalizing the invoices will create entries, which are then to be associated with the existing payments to become settled. Finally, the payments will set the invoices Paid
.
Assume the order process and payment transaction in the sales portal are completed. Now the sales portal integration uses the API or import processes to create
- a payment record for the collected payment, and
- a record to hold the sales order data.
The two records must include the same unique key to be used to to assign the (future) entry to the payment.
In JustOn Billing & Invoice Management, you have the generic invoice run create invoices from the record that holds the sales order data. This copies the unique key from your sales order data record to the field Payment Assignment Key
on the invoice.
On invoice finalization, the batch process BatchCreateEntries creates a new entry related to the invoice, copying the unique key to the field Payment Assignment Key
on the entry.
Again on invoice finalization, the batch process BatchSettleEntries relates the new entry with the payment using the unique key (comparing Entry.PaymentAssignmentKey
with Payment.AssignmentKey
), completing the settlement.
As a result of the settlement, the integration with JustOn Billing & Invoice Management creates a balance (of the type Payment
) and immediately associates it with the invoice created before, setting it Paid
.