Payment Provider Integration
JustOn Cash Management can integrate your Salesforce org with payment service providers (PSP) in order to exchange payment information – in particular, to provide your buyers the option to pay their purchases (represented as entries) via the payment page.
For details, see Integrating Payment Provider.
Payment Workflow via Payment Provider
In broad strokes, payment requests are processed as follows:
- JustOn Cash Management prepares payment
- JustOn Cash Management encrypts the involved entries and publishes the payment page it to the buyer.
- Buyer executes payment
-
The buyer selects a payment service provider or payment method and releases the payment transaction.
JustOn Cash Management creates a Payment record with the status
Pendingand an Entry Item record with anExpected Amount. - Payment provider captures amount
-
The payment service provider captures the payment amount in the buyer's bank and notifies JustOn Cash Management about the result.
JustOn Cash Management creates a Payment Notification record that represents the capture result.
- The Payment Notification record has an
Amountvalue set. - The Payment record's
Statusis setCollectedand itsCollected Amountis registered. - On the Entry Item record, the
Expected Amountis deleted and anAssigned Amountvalue is set – which is transferred to the related Entry record asAssigned Amount. - With the
Open Amountcompletely covered, the Entry record'sStatusis setBalanced.
- The Payment Notification record has an empty
Amount. - The Payment record's
Statusremains or is resetPending. - The Entry Item record keeps or is restored its
Expected Amount. - The related Entry record's
Statusremains or is resetOpen.
- The Payment Notification record has an
- Bank transfers money
- The buyer's bank transfers the captured amount to the payment service provider. Subsequently, the payment service provider passes the amount to the merchant's bank.
Info
Collecting payments via PSPs and, consequently, settling the corresponding entries does not involve bank accounts.
The money transfer between the banks does not alter the payment and entry status or the settlement result.
Payment Page
JustOn Cash Management includes a payment page. It provides your buyers the option to pay their purchases (represented as entries) via integrated payment service providers.
In order to invite your buyers to pay, you publish a link to your payment page. This payment link looks like
https://payment.juston.cloud/pay/:link-id/to/:tenant
where :link-id encodes the relevant entries and :tenant represents your organization.
Info
The payment page link is valid for 90 days from the date of creation.

Example payment page
Text customization
Depending on your requirements, you can modify or translate the texts to be displayed on the payment page. To this end, JustOn Cash Management provides the custom Salesforce object Payment Page Configuration.
Payment page configurations hold customized texts or translations for payment page texts. Once payment page configuration records are available for a given locale, JustOn Cash Management retrieves the texts when loading the payment page.
Additional pages
Your business may require to publish payment-relevant information that does not "fit" in the text components of the payment page. To support this, you create additional custom pages that are linked with the payment page. You can use this, for example, to attach your terms and conditions.
JustOn Cash Management implements support for custom pages using the Salesforce object CMS Page. Once CMS Page records are available for a given locale and set Active, JustOn Cash Management produces a list of links to these custom pages in the payment page footer when loading the payment page.
Clicking a link opens the page in a modal window. Closing this window returns the user to the payment page, ready to continue the payment process.
For details, see Configuring Payment Page.
Payment Automation
Payment providers may offer support for pre-authorized, merchant-initiated payment transactions – so-called future payments, provider-specific means to pre-authorize and execute recurring charges (or other subsequent payments) without the need to repeatedly prompt customers for interaction.
Info
Usually, merchant-initiated transactions are specifically negotiated with and provided by payment service providers. Contact your PSP for details.
Future payments also allow for collecting direct debits via a PSP, like Bacs Direct Debit. In this case, the mandate is held by the PSP, not by JustOn Cash Management. For details, see Can I collect direct debits via a payment service provider?
Payment Token Storage
To support future payments and the automatic payment collection, JustOn Cash Management can save payment tokens as payment instruments. As part of the payment provider configuration, merchants can enable the option to save payment tokens for future use. The following settings are available:
| Option | Result |
|---|---|
| Disabled | Payment data will not be saved, no display on the payment page. |
| Explicit Consent | Displays a toggle switch to let buyers decide whether to save payment data or not, preset No.Buyers must expressly agree to the payment data storage. |
| Explicit Opt-out | Displays a toggle switch to let buyers decide whether to save payment data or not, preset Yes.Buyers must expressly reject the payment data storage. |
| Indirect Consent | Payment data will be saved when the payment is made, displays a text to inform buyers about this. Buyers indirectly agree to the payment data storage when making the payment. |
Once configured, the payment page exposes the selected option to buyers. The texts to be displayed with each option are configurable:
| Context | Relevant Text Field | Default Value |
|---|---|---|
| Explicit consent Explicit opt-out |
Storage Optional Consent | Allow your payment data to be saved and used again for future payments. |
| Indirect consent | Storage Indirect Consent | By clicking **Pay** you allow [company] to save and use your payment data for future payments. |
| Successful data storage | Storage Result Heading | Payment Data |
| Data storage failure | Storage Results Error Message | We could not save your payment data. But this is not a problem, we will ask you to save it again when you make the next payment. |
Payment Run
JustOn Cash Management can make use of merchant-initiated transactions, executing payment runs in order to automatically collect payments on a regular basis. To this end, JustOn Cash Management provides the dedicated Apex class PaymentRunJob, which is to be scheduled using the standard Salesforce Schedule Apex functionality. For details on setting up the payment run, see Configuring PSP Payment Run.
For the payment run to work, it requires an eligible payment instrument as well as an eligible and capturable entry.
Eligible Entries
Entries must meet the following conditions to be eligible for being captured using the payment run:
| Field | Description |
|---|---|
| Account | The associated account for the debtor |
| Type | The type of the entry, must be Debit |
| Payable Amount | The amount to be captured, which must be non-zero |
| Status | The status of the entry, must be Open |
| Statement Payment Due Date | The payment due date of the statement, that is, the agreed collection date, which must be before or the same as the current date |
| Requested Payment Method | The requested payment method for the entry, must be empty or Online Payment |
| Requested Payment Instrument | The payment instrument to be used for paying the entry (optional, see Capturable Entries, required for future payments) |
| Requested Payment Provider | The payment provider to be used for paying the entry (optional, see Capturable Entries) |
| Exclude From Payment Run | Indicator to exclude the entry from the payment run, must be false |
As long as a payment for the entry is pending, the Expected Amount of its entry item reduces the entry's Payable Amount, so the payment run does not capture the entry again. If the payment fails, the entry becomes eligible again. The payment run then retries the capture on each execution until it succeeds, or until JustOn Cash Management excludes the entry or no eligible payment instrument is left (see Capture Results and Failed Payments per Payment Instrument).
Eligible Payment Instruments
Payment instruments must meet the following conditions to be used for capturing an entry:
| Field | Description |
|---|---|
| Account | The associated account for the debtor, must be the same as set for the entry |
| Type | The type of the payment instrument, must be Online Payment |
| Is Active | Indicator that shows whether the payment instrument is active, must be true |
| Payment Provider Is Active | Indicator that shows whether the connected payment provider is active, must be true |
| Money Flow Incoming | Money flow restriction for incoming money (→ collecting receivables), must be unrestricted for the payment instrument to be used to capture entries with a positive payable amount |
| Money Flow Outgoing | Money flow restriction for outgoing money (→ settling payables or return claims), must be unrestricted for the payment instrument to be used to capture entries with a negative payable amount |
| Business Entity | The payment instrument can only be used to capture entries that relate to the same business entity |
Capturable Entries
The payment run will ignore entries that are not capturable. For entries to be capturable, they must be both eligible and associated to an eligible payment instrument.
JustOn Cash Management determines the payment instrument to be used applying the following criteria:
- If the entry has the
Requested Payment Instrumentfield set, JustOn Cash Management selects the specified payment instrument from the eligible payment instruments. If the specified payment instrument is not eligible, the entry is not capturable. - If
Requested Payment Instrumentis not set but, instead, theRequested Payment Providerfield, JustOn Cash Management selects an eligible payment instrument that is related to the given payment provider. If it is not possible to select a payment instrument this way, the entry is not capturable. - If neither field is set, JustOn Cash Management selects an eligible payment instrument from the payment instruments based on the account related to the entry. If it is not possible to select a payment instrument this way, the entry is not capturable.
Ultimately, both the entry and the payment instrument must relate to the same account. Otherwise, the entry will bot be subject to the payment run.
Capture Results
Capturing entries using the payment run may yield one of the following results, respectively:
- Success
- The requested amount has been successfully captured from the payment provider. JustOn Cash Management has created a payment record with the status
Collected, and has fully settled the entry. - Delayed
-
The payment provider currently processes too many requests. It has temporarily rejected the current request and asked JustOn Cash Management to repeat it after some seconds – which may result in a success or a failure. JustOn Cash Management has created a payment record with the status
Pending, and has set theExpected Amounton the entry.If the payment provider rejects the repeated request again, the capture ends as a temporary failure with the message
Rate limited by payment provider. - Temporary Failure
-
The capture has failed for a reason that is not related to the entry or the payment instrument – for example, because the payment provider could not be reached, has reported an error on its side or has rejected the access data. JustOn Cash Management has created a payment record with the status
Failed, and will retry to capture the entry on the next payment run execution.What is a temporary failure?
A capture ends as temporary failure for one of the following reasons. The effect on the payment provider depends on the reason (see Payment Provider Deactivation).
Reason Examples Effect on Payment Provider Payment provider not reachable Timeout, network or SSL error Counts as communication failure Error on the payment provider's side HTTP status 5xx, other HTTP errors not listed here (for example, 409), unexpected response Counts as communication failure Salesforce not reachable during the capture Error when JustOn Cash Management calls Salesforce while processing the capture Counts as communication failure Access data or request rejected Invalid or missing API key, HTTP status 401 or 403, request rejected as invalid (HTTP status 400, 405 or 415) Deactivates the payment provider Payment provider implementation error Error in the payment provider implementation while calling the payment provider Deactivates the payment provider Rate limit The payment provider rejects the repeated request again (HTTP status 429) Resets Communication Failures– the connection has workedThe following are not temporary failures:
-
The payment provider rejects the entry, the payment instrument or the payment (HTTP status 404, 410 or 422).
These are permanent failures, see below.
-
The payment provider asks to repeat the request later (HTTP status 429).
The payment run waits and repeats the request once, see Delayed above.
-
Processing the capture fails within JustOn Cash Management:
-
Building the payment data fails (before the payment provider is contacted).
This sets the payment to
Failedwith the messageInternal Errorand creates an error report of the typepayment-run/capture-internal-error, without affecting the payment provider. -
Processing the payment provider's response fails.
This creates an error report of the type
payment-run/capture-internal-error. The payment keeps the result of the payment provider: if successful, it remainsPendingwith the provider's payment ID; in case of an error, it is set toFailedwith the provider's message. The connection status of the response counts as usual, that is, an answer of the payment provider resetsCommunication Failures.
-
-
A custom automation, like a record-triggered flow or a validation rule, rejects saving the results in Salesforce.
This aborts the payment run, without affecting the payment provider or the payment instrument. For details, see Payment Provider Deactivation.
For the involved payment instrument, JustOn Cash Management sets
Last Capture Messageto the error message returned by the payment provider, or toInternal Errorif the capture has failed within JustOn Cash Management or because Salesforce could not be reached during the capture. It also updatesLast Capture AmountandLast Capture Time, but notLast Successful Capture Time– which is whyLast Capture Is Successshowsfalse. For details, see Last Capture Information.In addition, JustOn Cash Management creates an error report of the type
payment-run/capture-temporary-failure, including the information needed to understand and possibly solve the issue.Depending on its cause, a temporary failure counts as communication failure of the payment provider or deactivates the payment provider immediately. For details, see Payment Provider Deactivation.
-
- Permanent Failure
-
The payment provider has rejected the capture because of an issue with the entry, the selected payment instrument or the payment itself.
-
Entry
The entry is considered invalid, for example because of an exceeded amount value or a mismatching currency. In this case, JustOn Cash Management creates a payment record with the status
Failedand the open amount0, and excludes the entry from future payment run executions (selecting the checkboxExclude From Payment Run). The exclusion reason is specified in thePayment Run Exclusion Reasonfield. -
Payment instrument
The payment instrument has been rejected by the payment provider, for example because of an invalid credit card number. In this case, JustOn Cash Management creates a payment record with the status
Failedand the open amount0, and excludes the payment instrument from future capture attempts within the same or future payment run executions (deselecting theIs Activecheckbox). The deactivation reason is specified in theDeactivation Reasonfield. -
Payment
The payment cannot be processed, for example because the payment provider reports it as not found or no longer available, or because the payment run does not support the type of the payment provider. In this case, JustOn Cash Management creates a payment record with the status
Failedand the open amount0, without excluding the entry or deactivating the payment instrument.
If the payment provider has returned an error response, JustOn Cash Management also creates an error report of the type
payment-run/capture-permanent-failure. -
Payment Provider Deactivation
The payment run deactivates a payment provider in two cases:
-
Too many communication failures
The payment provider could not be reached in a number of consecutive payment runs.
-
Broken connection
The connection to the payment provider does not work as set up, and retrying will not help until someone fixes the issue.
To this end, JustOn Cash Management evaluates for each capture and refund whether the connection to the payment provider has worked:
| Connection | Typical Causes | Effect |
|---|---|---|
| Worked | The payment provider has answered the request – whatever the result, including success, permanent failures and requests to repeat later | Resets Communication Failures to 0 |
| Failed | Network error, timeout, error on the payment provider's side (HTTP status 5xx), error when calling Salesforce during the capture or refund | If the connection has failed for all captures and refunds of the payment provider within the payment run, increases Communication Failures by 1 |
| Broken | Rejected access data (HTTP status 401 or 403), missing API key, request rejected as invalid (HTTP status 400, 405 or 415), error in the payment provider implementation | Deactivates the payment provider immediately, leaving Communication Failures unchanged |
Errors that occur when JustOn Cash Management saves the results in Salesforce – for example, because a custom automation, like record-triggered flows, validation rules or required fields, rejects the update of a payment, entry, entry item or balance – concern neither the payment provider nor the payment instrument. They do not affect Communication Failures. Instead, the payment run aborts:
- The results of the affected chunk of up to 10 payments are not saved, including captures the payment provider has already accepted. These payments keep the status
Pendinguntil the payment provider's notification updates them. - The payment run does not process the remaining captures and refunds.
- JustOn Cash Management creates an error report of the type
error.salesforce/persist, which specifies the rejected request and the error returned by Salesforce.
In this case, you must fix the automation. The next payment run processes the remaining entries.
That is, Communication Failures counts the consecutive payment runs in which the payment provider could not be reached, no matter how many payments are involved. Captures and refunds of the same payment run count as one payment run. Once the count reaches the retry threshold (by default, 10), JustOn Cash Management deactivates the payment provider. Administrators can define the retry threshold according to their org's requirements.
Example: Counting communication failures with retry threshold 3
| Payment Run | Result for the Payment Provider | Communication Failures |
|---|---|---|
| 1 | All 25 captures fail with a timeout. | 1 |
| 2 | 19 captures fail with a timeout, one is rejected because of an invalid card number. | 0 |
| 3 | The payment provider cannot be reached. | 1 |
| 4 | The payment provider cannot be reached. | 2 |
| 5 | The payment provider cannot be reached. | 3 – the payment provider is deactivated |
In payment run 2, the payment provider has answered one request, so the connection has worked.
When deactivating a payment provider, JustOn Cash Management creates an error report of the type payment-run/payment-provider-deactivated. Its message specifies the reason: Payment Provider deactivated due to too many communication failures or Payment Provider deactivated due to a broken connection. The payment run does not submit the remaining captures and refunds for this payment provider. It sets their payments and refunds to Failed with the message Skipped: Payment Provider deactivated. The entries remain eligible and are captured once the payment provider has been reactivated. Skipped refunds must be handled like other failed refunds (see Refund Results).
Note
JustOn Cash Management does not automatically send notifications when it deactivates a payment provider. Administrators must consult the error reports, solve the issue, and reactivate the payment provider. For details, see Reactivating Payment Provider.
Failed Payments per Payment Instrument
JustOn Cash Management counts the failed payments of a payment instrument in the payment instrument's Retry Count field. The count increases
- when the payment run receives a permanent failure caused by the payment instrument, and
- when the payment provider reports a payment as failed later, for example because of insufficient funds on the card.
This applies to all payments via the payment provider, including those started on the payment page. Temporary failures and permanent failures caused by the entry or the payment do not count.
A collected payment resets Retry Count to 0, and clears Last Capture Message and Last Capture Notification, provided the payment instrument is active.
Once Retry Count reaches the retry threshold (by default, 10), JustOn Cash Management deactivates the payment instrument and sets its Deactivation Reason to Too many failed payments. This keeps the payment run from retrying entries indefinitely with a payment instrument that cannot be charged. Payment instruments and payment providers share the same retry threshold.
Payment Run Notifications
JustOn Cash Management can inform customers about the produced payment run result. To this end, it makes use of the messaging mechanism based on customer notifications.
In the payment run context (where Business Process is set to Payment Run), JustOn Cash Management currently supports notifications for the following events:
| Payment Run Result | Notification Condition | Description |
|---|---|---|
| No active payment instrument | Payment Invitation |
The amount of the related (eligible) entry cannot be captured because there is no active payment instrument, or because the payment run does not support the payment instrument's payment provider. |
| Success | Payment Successful |
The amount of the related entry has been successfully captured using the related payment instrument. |
| Entry failure | Entry Excluded |
The amount of the related entry could not be captured because of errors in the entry, which is therefore excluded from further payment runs. |
| Payment instrument failure | Payment Instrument Deactivated |
The amount of the related entry could not be captured because of errors in the related payment instrument, which is therefore deactivated. |
JustOn Cash Management stores the actual messages produced during the payment run with the relevant records:
- Messages produced when no active payment instrument is found are saved to the corresponding (eligible) entry's
Last Notificationfield. In addition, JustOn Cash Management creates a payment link and saves it to the entry's fieldPayment Linkfield. - Messages produced on successful capture or because of an entry failure are saved to the corresponding entry's
Last Notificationfield. - Messages produced because of a payment instrument failure are saved to the corresponding payment instrument's
Last Capture Notificationfield.
Refund Handling
If payments are processed via a payment service provider, any related refunds must be handled via the PSP as well. Basically, JustOn Cash Management supports two approaches:
- Users can create refund records starting from the original payment record. Once these refunds are approved, the payment run can pick them up and send them to the payment provider.
- Users can initialize refunds via the PSP.
Refund via Payment Run
The payment run can submit refund requests to the payment service provider based on previously processed payments. This functionality does not support refunds without a direct reference to existing payment transactions (so-called unreferenced refunds or credit transfers).
For the refund via payment run to work, it requires an eligible refund as well as an eligible payment:
Eligible Refunds
| Field | Description |
|---|---|
| Status | The status of the refund must be Approved |
| Open Amount | The amount must be positive |
| Refunded Amount | The refunded amount must be zero |
| Payment Id | Must relate to an eligible payment |
Eligible Payment
| Field | Description |
|---|---|
| Status | The status of the payment must be Collected or Final |
| Payment Id | Has been given by the payment provider and is used again during refund submission |
| Payment Provider | Must be an active payment provider of a type that supports refunds via the payment run (currently, Mollie and JustOn Test Payments) |
Refund Results
Issuing refunds using the payment run may yield one of the following results, respectively:
- Success
-
The refund request has been successfully submitted to the payment provider. JustOn Cash Management has updated the refund record setting the status
Pendingand adding the provider-specific refund ID.After the payment provider has actually paid the refund, JustOn Cash Management changes the refund status to
Refunded. - Delayed
-
The payment provider currently processes too many requests. It has temporarily rejected the current request and asked JustOn Cash Management to repeat it after some seconds – which may result in a success or a failure. JustOn Cash Management has updated the refund record, setting the status
Pendingbut without immediately adding a provider-specific refund ID. The refund identifier will be set if the refund is successful.If there is no provider-specific refund ID after the payment run has completed, you are advised to review the error report to identify potential issues. Once the issues are resolved, users can re-approve the refund (see Approving Refund) for the next payment run.
- Temporary Failure
-
The refund has failed for a reason that is not related to the refund itself – for example, because the payment provider could not be reached or has rejected the access data. JustOn Cash Management has set the refund status
Failed, has saved the error message to the refund'sError Messagefield and, if the payment provider has returned an error response, the response to theError Responsefield. In addition, it creates an error report of the typepayment-run/refund-temporary-failure.The payment run only picks up refunds in the status
Approved. It does not resubmit a failed refund automatically, and failed refunds cannot be approved again. Once the issue is resolved, users can either- repeat the refund as SEPA Credit Transfer, or
- cancel the failed refund, which makes the amount available on the original payment again, and create a new refund from the original payment for the next payment run.
For the connection to the payment provider, refunds follow the same rules as captures. Captures and refunds of the same payment run count as one payment run. For details, see Payment Provider Deactivation.
- Permanent Failure
- The payment provider has rejected the refund, for example because the amount exceeds the refundable amount of the payment. JustOn Cash Management has set the refund status
Failed, and has saved the error message to theError Messagefield and the payment provider's response to theError Responsefield. In addition, it creates an error report of the typepayment-run/refund-permanent-failure.
Refund via Payment Provider
Typically, users initialize refunds based on the original payment in JustOn Cash Management. Certain circumstances, however, may require refunds to be initialized via a payment service provider. In this case, any transactions will synchronize with JustOn Cash Management via webhook notifications. Subsequently, JustOn Cash Management will update both payment and refund records accordingly:
- Each webhook notification results in the creation of a Payment Notification record linked to the original Payment record. The payment notification captures current changes or data related to the payment and refund.
- Based on the webhook notification, JustOn Cash Management creates or updates a corresponding Refund record, with the
Open Amountin accordance with the refunded payment (see Refund Amount Values). This ensures the accurate reflection of the refund status in JustOn Cash Management. - Should the refund status update to
Refunded, JustOn Cash Management will adjust theOpen Amountand theCollected Amountof the related payment (see Payment Amount Values) in accordance with the refunded amount. - Any related entries might also be updated in response to the refund processing, ensuring that settled amounts remain up-to-date.
JustOn Cash Management supports refunds in response to payments made via Mollie.
Be aware that refunds initialized via payment service providers may require some manual processing, see Managing Payment Provider-Initiated Refunds.