Newer Version Available

This content describes an older version of this product. View Latest

Order Summaries, Ensure Funds Async

Ensure funds for an invoice and apply them to it. If needed, capture authorized funds by sending a request to a payment provider. This method inserts a background operation into an asynchronous job queue and returns the ID of that operation so you can track its status. Payment gateway responses appear in the payment gateway log and do not affect the background operation status.
Resource
Available version
48.0
Requires Chatter
No
HTTP methods
POST
Request body for POST
Ensure Funds Async Input
Root XML tag
<ensureFundsAsyncInput>
JSON example
Properties
Name Type Description Required or Optional Available Version
invoiceId String ID of the invoice. Required 48.0
Response body for POST
  • When the HTTP status code indicates success, the response body is an Ensure Funds Async Output. The response body can still indicate processing errors.
  • When the HTTP status code is in the 400 (client error) or 500 (server error) range, the response body is an Error with Output. The output property is an Ensure Funds Async Output, and the value of the enhancedErrorType property can be ignored.
Usage

This method checks the OrderPaymentSummaries associated with the specified OrderSummary for funds to apply to the invoice balance as follows:

If multiple OrderPaymentSummaries have the same amount, their order of selection is random.

Note

  1. Verify that the invoice balance doesn’t exceed the total amount of all the OrderPaymentSummaries.
  2. If an OrderPaymentSummary exists with an amount that matches the invoice balance, use it.
  3. Otherwise, if any OrderPaymentSummaries exist with an amount greater than the invoice balance, use the one with the smallest amount greater than the invoice balance.
  4. Otherwise, select OrderPaymentSummaries in order from largest amount to smallest until their amounts meet or exceed the invoice balance.
  5. If any selected funds are authorized, capture them.
  6. Apply the selected funds to the invoice.